Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Mon Jun 29, 2015 12:13 pm

How do I make special characters like the Norwegian æøå?

When using the demo code they will appear as a question mark.

tmeistad
 
Posts: 2
Joined: Mon Jun 29, 2015 12:00 pm

Tue Jun 30, 2015 6:04 am

Hello,

Thanks for your inquiry.
Please use the below method to embed this kind of font in the generated pdf.
Code: Select all
 PdfDocument doc = new PdfDocument();
            PdfPageBase page = doc.Pages.Add();
            String fontFileName = "calibri.ttf";
            PdfTrueTypeFont trueTypeFont = new PdfTrueTypeFont(fontFileName, 20f);
            page.Canvas.DrawString("æøå", trueTypeFont, new PdfSolidBrush(Color.Black), 10,

10);
            doc.SaveToFile("sample.pdf");


Best Regards,
Sweety

E-iceblue support team
User avatar

sweety1
 
Posts: 539
Joined: Wed Mar 11, 2015 1:14 am

Thu Jul 02, 2015 3:20 am

Hello,

Have you tried the method?
Has your issue been resolved?
Could you please give us some feedback at your convenience?

Best Regards,
Sweety

E-iceblue support team
User avatar

sweety1
 
Posts: 539
Joined: Wed Mar 11, 2015 1:14 am

Mon Jul 20, 2015 11:53 am

Yes, it solved my problem. I can do it like this.

var text = File.ReadAllText("c:\\temp\\PdfTest.txt", Encoding.Default);
var doc = new PdfDocument();
var page = doc.Pages.Add();
var trueTypeFont = new PdfTrueTypeFont(new System.Drawing.Font("Arial", 20f, FontStyle.Regular));
page.Canvas.DrawString(text, trueTypeFont, new PdfSolidBrush(Color.Black), 10, 10);
doc.SaveToFile("c:\\temp\\PdfTest.pdf");

Thanks.

tmeistad
 
Posts: 2
Joined: Mon Jun 29, 2015 12:00 pm

Tue Jul 21, 2015 1:23 am

Hello,

I am glad to hear that you solved your issue.
Please feel free to contact us, if you have any questions or needs. We are here for help.

Best Regards,
Sweety
E-iceblue support team
User avatar

sweety1
 
Posts: 539
Joined: Wed Mar 11, 2015 1:14 am

Return to Spire.PDF