Home > Back-end >  LlPDFLib Chinese garbled
LlPDFLib Chinese garbled

Time:11-13

As title, I use BCB6, downloaded from the Internet llPDFLib. V3.6 plug-in, generate PDF, in English, but Chinese is garbled, code is as follows:
PDFDocument1 - & gt; FileName="C: \ \ tt PDF";;
PDFDocument1 - & gt; AutoLaunch=true;
PDFDocument1 - & gt; PageLayout=plSinglePage;
PDFDocument1 - & gt; BeginDoc ();
PDFDocument1 - & gt; Compression will=ctNone;
TFontStyles CurrentFontStyle=TFontStyles () & lt; PDFDocument1 - & gt; CurrentPage - & gt; SetActiveFont (" black ", CurrentFontStyle, 20, GB2312_CHARSET);
PDFDocument1 - & gt; CurrentPage - & gt; TextOutput (220, 10, 0, "Chinese gibberish");
Then I try to output from canvas, this time no problem:
PDFDocument1 - & gt; Brought by ();
PDFDocument1 - & gt; CurrentPage - & gt; SetActiveFont (" black ", CurrentFontStyle, 20, GB2312_CHARSET);//Show page header
PDFDocument1 - & gt; Canvas - & gt; The Font - & gt; Style=TFontStyles () & lt; PDFDocument1 - & gt; Canvas - & gt; The Font - & gt; Size=20;
PDFDocument1 - & gt; Canvas - & gt; The Font - & gt; Name="bold";
PDFDocument1 - & gt; Canvas - & gt; The Font - & gt; Charset=GB2312_CHARSET;
PDFDocument1 - & gt; Canvas - & gt; The Font - & gt; Charset=0;
PDFDocument1 - & gt; Canvas - & gt; TextOut (350, 80, "normal" in Chinese). I want to ask you how to solve this problem, thank you!

CodePudding user response:

GB2312_CHARSET
Is there a link between with character set?

CodePudding user response:

The problem is, you should not use canvas to set up and the output text, and should be used:
CurrentPage - & gt; SetActiveFont (' song typeface, [], 40).
CurrentPage - & gt; TextOut (40400-45, 'it's just a test);
And the last parameter "GB2312_CHARSET don't need,"
I version 6.4 of the right,

CodePudding user response:

TextOut indeed can't, but you can use WideTextOut can use UnicodeTextOut llpdflib6.4 version 3.6
  • Related