Articles in this section
Category / Section

How to display unicode text in Pdf WinRt

1 min read

Essential PDF does not provide direct support for rendering Unicode text in WinRT platform. As WinRT does not provide access to installed font data, Unicode fonts cannot be embedded directly. Instead, the font file can be added as an embedded resource to the application, from where it can be embedded in the PDF Document.

You can use the PdfTrueTypeFont to display the Unicode font in the PDF, Please refer the below code snippet.

[C#]
 
Assembly assembly = typeof(MainPage).GetTypeInfo().Assembly;
//Gettin the fontdata
Stream fontData = assembly.GetManifestResourceStream("PdfUnicodeFontSample.Assets.arial.ttf");
//creating the docuement
PdfDocument document = new PdfDocument();
PdfPage page = document.Pages.Add();
//creating the true type font
PdfTrueTypeFont font = new PdfTrueTypeFont(fontData, 20);
//drawing the string
page.Graphics.DrawString("Sample@#% unicode test%3^*", font, PdfBrushes.Red, 0, 0);
 
MemoryStream stream = new MemoryStream();
//saving the document
document.Save(stream);
 
Save(stream);
 

 

Sample:

The below sample shows how to add a font file as embedded resource and how the Unicode text can be drawn to the PDF document.

http://www.syncfusion.com/downloads/support/directtrac/general/PdfUnicodeFontSample1174984094.zip

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied