We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to display unicode text in Pdf WinRt

Platform: WinRT |
Control: PDF |
Published Date: November 13, 2014 |
Last Revised Date: November 13, 2014
Tags: pdf, fonts

How to display Unicode text in Pdf document in WinRT platform

 

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

ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon