Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Wed Feb 03, 2021 3:36 pm

Hi,

I am using Spire.Pdf.HtmlConverter.Qt.HtmlConverter.Convert to convert HTML to PDF.
Unfortunately HTML with chinese characters will displayed as ??? after save to PDF.
May I know how should I resolved this?

Example code:
string htmlCode = "<div style='font-family: Lucida, Helvetica, Arial, sans-serif; color: #333;'><h1 style='font-size: 18px; text-align: center; color:#666;'>接收记录</h1></div>"

var filepath = HttpContext.Current.Server.MapPath("//filename.pdf");

Spire.Pdf.HtmlConverter.Qt.HtmlConverter.Convert(htmlCode, filepath,
true,
10 * 1000,
PdfPageSize.A4,
new PdfMargins(20),
LoadHtmlType.SourceCode
);

System.Diagnostics.Process.Start(filepath);

Thanks.

ascylee84
 
Posts: 2
Joined: Tue Jan 26, 2021 9:27 am

Thu Feb 04, 2021 2:12 am

Hello,

Thanks for your inquiry!

Kindly note that you must make sure that your OS has the font that supports Chinese character before you convert the HTML code to PDF.

If the issue still exists after the font has been installed, please provide us with your OS information (E.g. Win7, 64 bit) and region setting (E.g. China, Chinese) for reference. Thanks in advance.

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Mon Feb 08, 2021 2:38 am

Hello,

Hope you are doing well!

How is the issue now? If it still exists, could you please provide us with your OS information (E.g. Win7, 64 bit) and region setting (E.g. China, Chinese) for reference?

Thanks in advance.

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Tue Mar 23, 2021 11:34 am

Sorry for replying late. Yeah the issue still there.
Here are the informations.

OS information : Windows Server 2016 Datacenter, 64 bit
Region setting : United States, English

I understand that the windows need to have the font to support Chinese characters. By default, there are some Chinese fonts available in the windows.
May I know what is the font used in Spire.Pdf.HtmlConverter.Qt.HtmlConverter.Convert plugin which can support Chinese characters?

Thanks again :)

ascylee84
 
Posts: 2
Joined: Tue Jan 26, 2021 9:27 am

Wed Mar 24, 2021 6:34 am

Hello,

Thanks for your feedback!

I noticed that the font-family (Lucida, Helvetica, Arial, sans-serif) of your html are Es fonts, they don't support rendering Chinese characters. I suggest that you first set a chinese font such as (Dengxian, Fangsong, Kaiti, Microsoft YaHei, Microsoft YaHei UI, simhei, Simsun, and Simsun extb) for you HTML string. Meanwhile, please make sure that the fonts you defined are installed on your system. Then convert your html to PDF. If the issue still happens, please porvide your generated PDF for our reference. Thanks in advance!

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Wed Apr 14, 2021 9:12 am

Hello,

Greetings from E-iceblue.

How is the issue now? If it still exists, could you please provide your generated PDF to us for further investigation?

Thanks in advance.

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Return to Spire.PDF