Can't get pdftruetypefont code to compile

Hello, I read in the doc that I need truetype font to display some symbols and that I had to to that:

PdfFont font = new PdfTrueTypeFont(new Font("Arial Unicode MS", 14), true);

But PdfTrueTypeFont wants a stream object where Font returns a Font object and I don't find a class with the good return type.

Can someone help ?

Thanks

1 Reply

SL Sowmiya Loganathan Syncfusion Team March 13, 2018 01:13 PM UTC

Hi Gregory, 

Thank you for contacting Syncfusion support. 

We do not have a direct support to add a font as a string(font by name) in PdfTrueTypeFont to draw Unicode text(Symbol) in Xamarin Android. By initializing the PdfTrueTypeFont with font as a Stream this can be achieved. Please find the below code snippet to returns the font object using PdfTrueTypeFont. 

            //Load the true type font.  
            Stream fontstream = typeof(MainPage).GetTypeInfo().Assembly.GetManifestResourceStream("App1.Assets.arial.ttf"); 
 
            //Initialize the PDF true type font.  
            PdfFont font = new PdfTrueTypeFont(fontstream, 12, PdfFontStyle.Regular); 


Please refer the below discussion forum link for more details: 

Please let us know if you need further assistance on this. 

Regards, 
Sowmiya L 


Loader.
Up arrow icon