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

Is it possible to generate a PDF with Polish characterset in .NET Core

Hi,

I've been attempting to generate a PDF that contains polish characters.

I'm using a .net core 1.1 web app with Syncfusion.Pdf.AspNet.Core v 14.4600.0.20-preview2-final

I've tried various techniques that I've found from the forum / documentation but none of them work.

1.
            var fontStream = File.OpenRead("PdfAssets/TheanoDidot-Regular.ttf");
            var headingFont = new PdfTrueTypeFont(fontStream, 20);

Throws a NotSupportedException containing inner exception - No data is available for encoding 1252. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.

2.

PdfFont font = new PdfTrueTypeFont(new Font("Arial.ttf", 14));

Seems to be from an older / different version to what I'm running - PdfTrueTypeFont constructor does not take 1 argument.


Any assistance would be greatly appreciated.



1 Reply

CM Chinnu Muniyappan Syncfusion Team February 8, 2017 12:17 PM UTC

Hi Julian, 
 
Thank you for contacting Syncfusion support. 
 
 
I've been attempting to generate a PDF that contains polish characters. 
 
I'm using a .net core 1.1 web app with Syncfusion.Pdf.AspNet.Core v 14.4600.0.20-preview2-final 
 
I've tried various techniques that I've found from the forum / documentation but none of them work. 
 
1. 
            var fontStream = File.OpenRead("PdfAssets/TheanoDidot-Regular.ttf");
            var headingFont = new PdfTrueTypeFont(fontStream, 20);
 
 
Throws a NotSupportedException containing inner exception - No data is available for encoding 1252. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method. 
 
Yes, we have supported polish characters by using PdfTrueTypeFont in Asp.Net Core platform, however we are able to reproduce the problem with “Exception occurs while using PdfTrueTypeFont. A support incident to track the status of this defect has been created under your account. Please log on to our support website to check for further updates 
 
2. 
 
PdfFont font = new PdfTrueTypeFont(new Font("Arial.ttf", 14)); 
Seems to be from an older / different version to what I'm running - PdfTrueTypeFont constructor does not take 1 argument. 
 
Any assistance would be greatly appreciated. 
 
PdfTrueTypeFont does not support System.Drawing.Font as an overload in Asp.Net core platform, so we have suggested you to use the anther overload for the font stream as input in PdfTrueTypeFont, Please refer the below code snippet for more details. 
 
//Load the custom font as stream 
            Stream fontStream = File.OpenRead("Font/arial.ttf"); 
 
            //Create a new PDF true type font. 
            PdfTrueTypeFont tFont = new PdfTrueTypeFont(fontStream, 12,PdfFontStyle.Regular); 
 
 
Please let us know if you have any concern. 
Regards, 
Chinnu 


Loader.
Live Chat Icon For mobile
Up arrow icon