Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!
Code page {936} GB2312_CHARSET |
Post Reply |
Author | |
lenc
Beginner Joined: 15 May 12 Status: Offline Points: 2 |
Post Options
Thanks(0)
Posted: 19 Sep 12 at 6:09PM |
How to output Chinese (Simplified)?
With the following, int docID = qp.NewDocument(); int ttfID = qp.AddTrueTypeFont("Arial Unicode MS [Italic]", 0); qp.SelectFont(ttfID); qp.SetTextSize(10.0); double pageTop = qp.GetPageBox(2, 1); double textHeight = qp.GetTextHeight(); qp.DrawText(10, pageTop - (textHeight * 1) - 5, "... a day in the life"); qp.DrawText(10, pageTop - (textHeight * 2) - 5, "... 生活中的一天"); qp.SaveToFile(savePath + "test.pdf"); qp.RemoveDocument(docID); Text in PDF output: ... a day in the life ... With the following, int docID = qp.NewDocument(); int ttfID = qp.AddTrueTypeFont("Arial Unicode MS [Italic] {936}", 0); qp.SelectFont(ttfID); qp.SetTextSize(10.0); double pageTop = qp.GetPageBox(2, 1); double textHeight = qp.GetTextHeight(); qp.DrawText(10, pageTop - (textHeight * 1) - 5, "... a day in the life"); qp.DrawText(10, pageTop - (textHeight * 2) - 5, "... 生活中的一天"); qp.SaveToFile(savePath + "test.pdf"); qp.RemoveDocument(docID); Text in PDF output (none): The text in the DrawText calls was copy/pasted from Google translate - English -> Chinese (Simplified). |
|
AndrewC
Moderator Group Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
Post Options
Thanks(0)
|
Which version of Quick PDF Library are you using ? 7.xx or 8.xx ? In 8.xx we changed all the internal strings in the library to Unicode so it is not possible to send a DBCS encoded string to the 8.xx version of QPL. For this reason we have recently deprecated the support of the following code pages from QPL 8.xx. Adding CJK fonts works correctly in 8.xx if you use the QPL.AddTrueTypeSubsetFont Andrew. No longer supported in QPL 8.xx ======================================= 932 (Japanese Shift-JIS) 936 (Simplified Chinese GBK) 949 (Korean) 950 (Traditional Chinese Big5) int ifontID2 = QP.AddTrueTypeSubsettedFont("MS Gothic", "こんにちは", 0); if (QP.SelectFont(ifontID2) == 1) { QP.DrawTextBox(30, QP.PageHeight() - 60, QP.GetTextWidth("こんにち は"), QP.GetTextHeight(), "こんにちは", 0); } Edited by AndrewC - 20 Sep 12 at 5:43AM |
|
lenc
Beginner Joined: 15 May 12 Status: Offline Points: 2 |
Post Options
Thanks(0)
|
Hi Andrew,
Thanks for the clarification and quick response! I'm using QPL 8.16. I was a bit confused on the 'Add*SubSettedFont' functions usage. Also, I did experiment a bit with the AddCJK function (even though reference states only 'Japanese "HeiseiKakuGo-W5" font is currently supported.) When I loaded the generated PDF, Acrobat Reader informed me that I needed a font package to display the document and offered a link to the Adobe site download location. lenc |
|
AndrewC
Moderator Group Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
Post Options
Thanks(0)
|
NOTE : This forum doesn't display Unicode text very well and converts it to the jumble of characters in the previous messages. These strings are meant to be human readable UNICODE strings with native CJK characters. QP.AddTrueTypeSubsettedFont("MS Gothic", "ã“ã‚“ã«ã¡ã¯", 0); We are slowly improving the Asian font support and more work will be done in 9.12 and 9.13. 9.11 now has support for rendering vertical Asian text from existing PDF files. AddTrueTypeSubsettedFont works pretty well with most fonts these days and is a pretty reliable method that add Asian fonts to a PDF.
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store