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. Image for the cookie policy date
close icon

Unicode support in UWP PDF API

We are trying to generate pdf in UWP application using PDF API.

And the need is that the Unicode characters should be able to be written to the PDF from the application. Can you please let us know whether multilingual Unicode characters are supported with PDF API from UWP.

 

Thanks in Advance for any inputs on this.


3 Replies

CM Chinnu Muniyappan Syncfusion Team July 26, 2016 11:48 AM UTC

Hi Anuj, 

Thank you for contacting Syncfusion support. 

PdfTrueTypeFont helps to rendering the Unicode characters in PDF document. Please find the below code snippet and sample for more details. 

            //Load the true type font. 
            Stream fontstream = typeof(MainPage).GetTypeInfo().Assembly.GetManifestResourceStream("App1.Assets.arial.ttf"); 
 
            //Create a new PDF document. 
            PdfDocument doc = new PdfDocument(); 
 
            //Add a new page. 
            PdfPage page = doc.Pages.Add(); 
 
            //Initialize the PDF true type font. 
            PdfFont font = new PdfTrueTypeFont(fontstream, 12, PdfFontStyle.Regular); 
 
            //Draw text. 
            page.Graphics.DrawString("hello world! @ # €", font, PdfBrushes.Black, new System.Drawing.PointF(0, 0)); 
 
Sample: 

Please let us know if you have any concern. 

Regards, 
Chinnu 



JO john August 3, 2022 04:52 PM UTC

Where do these true type fonts come from that are referenced in the example. There is never any instructions on where they come from. Are they provided from Syncfusion?



GK Gowthamraj Kumar Syncfusion Team August 4, 2022 12:34 PM UTC

Hi john,


The TrueTypeFont class is Syncfusion API. We can add text using the font file from local file system by providing the path of the TrueType font location. Please refer to the below documentation link for more information,

UG: https://help.syncfusion.com/file-formats/pdf/working-with-text?cs-save-lang=1&cs-lang=csharp#draw-text-using-truetype-fonts

We need to referred the suitable font file to Assert folder. Please refer the step 5 of below KB documentation for adding font file to the Assert folder and set the Build Action to Embedded Resource,
https://www.syncfusion.com/kb/9722/how-to-draw-the-euro-symbol-in-a-pdf-in-uwp


Please let us know if you need any further assistance in this.


Regards,

Gowthamraj K


If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.


Loader.
Live Chat Icon For mobile
Up arrow icon