This is a migrated thread and some comments may be shown as answers.

Exporting HTML to PDF with greek characters in HTML

2 Answers 320 Views
PdfProcessing
This is a migrated thread and some comments may be shown as answers.
web
Top achievements
Rank 2
Veteran
Iron
web asked on 02 Dec 2020, 07:40 AM

Hi Everyone,

i am trying to convert an HTML to PDF using RadFlowDocument. In HTML we have Greek Letters in the text and the export seems to ingore them and they are not printed in the final PDF.

 

This is a sample of my code:

<code>

string html = "<p>Greek Characters</p><p>Ε</p>";

var providerPdf = new Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider();
var memoryStream = new MemoryStream();

 var providerHtml = new Telerik.Windows.Documents.Flow.FormatProviders.Html.HtmlFormatProvider();
providerHtml.ExportSettings.ImagesExportMode = Telerik.Windows.Documents.Flow.FormatProviders.Html.ImagesExportMode.Embedded;
providerHtml.ExportSettings.ImageExporting += (s, e) =>
{
e.Handled = false;
                    e.Title = "Test image";
                    e.ExportSize = true;
                    e.AlternativeText = "You will see this text if the image is not loaded";
                };

                RadFlowDocument document = providerHtml.Import(finalHtml);
                providerPdf.Export(document, memoryStream);

                using (Stream output = File.OpenWrite(@"C:\TempThanasis\sample.pdf"))
                {
                    providerPdf.Export(document, output);
                }

 

</code>

 

Thanks

2 Answers, 1 is accepted

Sort by
0
web
Top achievements
Rank 2
Veteran
Iron
answered on 02 Dec 2020, 07:46 AM

Here is the exported pdf in print screen which ingores greek characters.

 

0
Dimitar
Telerik team
answered on 03 Dec 2020, 07:53 AM

Hi Chrysostomos,

What is the type of your application, is it a Net Framework application or Net Core application? If you are using a Net Core app you may need to manually register a font that contains the gree characters. You can check the current font from the document properties (see attached).

In addition, can you export the document to the docx format and see if the characters appear there? 

I am looking forward to your reply.

Regards,
Dimitar
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
PdfProcessing
Asked by
web
Top achievements
Rank 2
Veteran
Iron
Answers by
web
Top achievements
Rank 2
Veteran
Iron
Dimitar
Telerik team
Share this question
or