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!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - Code page {936} GB2312_CHARSET
  FAQ FAQ  Forum Search   Register Register  Login Login

Code page {936} GB2312_CHARSET

 Post Reply Post Reply
Author
Message
lenc View Drop Down
Beginner
Beginner


Joined: 15 May 12
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote lenc Quote  Post ReplyReply Direct Link To This Post Topic: Code page {936} GB2312_CHARSET
    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).

Back to Top
AndrewC View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 08 Dec 10
Location: Geelong, Aust
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post Posted: 20 Sep 12 at 5:43AM

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
Back to Top
lenc View Drop Down
Beginner
Beginner


Joined: 15 May 12
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote lenc Quote  Post ReplyReply Direct Link To This Post Posted: 20 Sep 12 at 5:12PM
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
Back to Top
AndrewC View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 08 Dec 10
Location: Geelong, Aust
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post Posted: 21 Sep 12 at 2:07AM
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.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store