Use aspose.pdf 21.12 to convert html files (contents of Chinese characters) to pdf garbled problem.
License license2 = new License();
try
{
license2.SetLicense("Aspose.Pdf.lic");
HtmlLoadOptions options2 = new HtmlLoadOptions();
Document pdfDocument2 = new Document(@"D:\demo\1.html", options2);
pdfDocument2.Save(@"D:\demo\1.pdf");
Console.WriteLine("successfully.");
}
catch (Exception ex){}
1.html Content:
<!DOCTYPE html>
<html>
<head><title></title></head>
<body>浏览、</body>
</html>
Output preview:
Snipaste_2021-12-31_19-51-53.png (2.5 KB)
Can you help me see how to solve this problem?
@Northman
If you create the PDF using shared HTML via Adobe Writer, you will get the same output. You need to specify the font name of text and install that font on the machine where you are converting HTML to PDF.
I am through the preparation of a good HTML file to generate the pdf, how do you say “specify the text of the font name” to set it?
Thank you very much for your answer, I hope to help me solve this problem again~
@Northman
@Northman
You can set the font style of text as shown below:
<p style="font-family:xxxx;">浏览、</p>
Unfortunately, the issue still exists after setting font name of text. For the sake of correction, we have logged this problem in our issue tracking system as PDFNET-51132. You will be notified via this forum thread once this issue is resolved.
We apologize for your inconvenience.
Thank you very much for your reply, waiting for good news!
The issues you have found earlier (filed as PDFNET-51132) have been fixed in Aspose.PDF for .NET 23.12.