Declined
Last Updated: 11 Dec 2019 06:32 by ADMIN
Benny
Created on: 04 Dec 2019 12:18
Category: WordsProcessing
Type: Bug Report
2
Special chars (åäö) with PdfFormatProvider

Special chars (åäö) with PdfFormatProvider wont work.

Project submitted!

    public void SpecialCharsTest()
        {
            RadFlowDocument document = new RadFlowDocument();

            RadFlowDocumentEditor editor = new RadFlowDocumentEditor(document);

            editor.InsertText("Before text");
            editor.InsertText("åäö ÅÄÖ ☕"); // This line will not appear in the pdf 
            editor.InsertText("After text");
            using (Stream output = new FileStream("specialCharTest.pdf", FileMode.OpenOrCreate))
            {
                PdfFormatProvider provider = new PdfFormatProvider();
                provider.Export(document, output);
            }
        }

Special characters wont work :-/

1 comment
ADMIN
Dimitar
Posted on: 10 Dec 2019 14:16

Hi Benny,

This happens because the system fonts cannot be accessed and exported with .NET Core (this works with .NET Framework). The exported document will fall back to one of the fonts that are in the fonts repository by default, but if the specific symbols are not available in the default font they will not be rendered. 

In order for this to work you need to manually add the fonts to the FontsRepository. This way the fonts will be embedded in the pdf document and the symbols will appear. In this case, you need to add two fonts: 

var fontData = File.ReadAllBytes(@"..\..\..\Calibri.TTF");
FontsRepository.RegisterFont(new Telerik.Documents.Core.Fonts.FontFamily("Calibri"), FontStyles.Normal, FontWeights.Normal, fontData);


fontData = File.ReadAllBytes(@"..\..\..\SEGUISYM.TTF");
FontsRepository.RegisterFont(new Telerik.Documents.Core.Fonts.FontFamily("Segoe UI Symbol"), FontStyles.Normal, FontWeights.Normal, fontData);

You can get the fonts from the Windows Fonts folder (Control Panel\All Control Panel Items\Fonts) and copy them to your project. 

We are already working on functionality that would simplify the above approach. I will set the status of this item to declined since there is nothing else that can be done here.

I hope this helps. Should you have any other questions do not hesitate to ask.

Regards,
Dimitar
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.