Reputation: 111
When converting a html file with Persian content, the result does not contain appropriate Persian content. All Persian content shows as ???
Upvotes: 2
Views: 820
Reputation: 780
now you can solve your problem by using itext7.pdfhtml and itext7.pdfcalligraph. install them using NuGet manager, and use this method to convert your Persian or Arabic Html to pdf :
public static void ConvertHtmlToPDF(string Html)
{
ConverterProperties properties = new ConverterProperties();
FontProvider fontProvider = new DefaultFontProvider();
properties.SetFontProvider(fontProvider);
PdfWriter writer = new PdfWriter(new FileStream(PDFFileAddressTobeGenerated, FileMode.Create));
PdfDocument pdfDocument = new PdfDocument(writer);
HtmlConverter.ConvertToPdf(htmlFile, pdfDocument, properties);
}
Upvotes: 1
Reputation: 12856
Are you starting your HTML with:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
Also ensure that the Persian fonts are installed locally.
Upvotes: 2