Print Page | Close Window

Codepage

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=3803
Printed Date: 04 May 24 at 12:15AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Codepage
Posted By: eborger
Subject: Codepage
Date Posted: 15 Apr 20 at 4:46PM
Hello,

I am trying to use baltic codepage (CP1257), and I cannot get all characters I need, I made a test program printing all characters from 00 to 255, and several characters that are special to baltic language do not show in the resulting pdf.

I used AddTrueTypeFont "Arial {1257}" (and other code pages as well) but did not get the whole table.

Can you help ?

Thanks,
Edgar

http://en.wikipedia.org/wiki/Windows-1257" rel="nofollow - http://en.wikipedia.org/wiki/Windows-1257



Replies:
Posted By: eborger
Date Posted: 15 Apr 20 at 5:43PM
runing the same program with V.7 works fine, with V.10 not


Posted By: Ingo
Date Posted: 15 Apr 20 at 8:48PM
Hi Edgar,

what do you mean with V.7 and V.10?
Windows 7 and Windows 10?
Or QuickPDF-version 7.xx and version 10.xx?
You'll know that'snot enough to embed the font - you have to select it, too.
Did you check that the font is embedded successfully?
Perhaps it has to do with how you're working with the strings?
You'll know that QuickPDF-strings are unicode strings?
Your relevant code could be very useful to help...



-------------
Cheers,
Ingo



Posted By: eborger
Date Posted: 15 Apr 20 at 9:48PM
Hi Ingo,

I meant the quick pdf library version, V7.26 and V10.16. Windows is 10 (the same machine).
and yes, I selected the font, as I said, the same program works for v7 and v10 of QPDF lib, the only difference is the strings that are unicode for V10 and ANSI for V7.

I can send you both files if you wish, just give me an email.

Thanks for your help, and regards,
Edgar



Posted By: eborger
Date Posted: 15 Apr 20 at 9:55PM
regarding the code, it is in Xbase++, bellow is a prototype of the code I use:


fn       := pdf:qCall("AddTrueTypeFont", pdf:oPdf, cszansi2wide('Arial {1257}'), 0 )
load font Arial with codepage 1257
oFont := pdf:qCall( "SelectFont", pdf:oPdf, fn )
select loaded font
ok  := pdf:qCall( "SetTextSize", pdf:oPdf, Dbl(8) )
set size to 8 (font = 8.Arial
x = 32
l = 6
for i = 2 to 15
for j = 0 to 15
   pdf:qCall("DrawText", pdf:oPdf, dbl(l), dbl(8.5+(j*3)) , cSzAnsi2Wide(chr(x)) )
draw text 
x = x + 1
next j
l = l + 2
next i


I hope you can understand the coding, let me know if you have any questions


Posted By: Ingo
Date Posted: 16 Apr 20 at 7:38AM
Hi Edgar,


if i read "ansi2wide" i think in this direction you should search further more.
You should use more control cause you don't know what's wrong.
After each function call don't work with the returning value but first check if this value is a valid one.
After each function call you can use a LastErrorCode to check if it's all okay.

If you want you can send me your pdf files to check them by myself (i've sent you an email).

This i've written in a past thread:
"...nternally strings will be handled as unicode.
Up to library version 7.26 they were encoded as utf8.
Starting from 8.xx version they are encoded with utf16.
So if you wanna handle with unicode before input you
should use something like encodeUtf16 or for output
decodeUtf16...."

If you'll search in the online references of Debenu/Foxit you'll find many similar issues...

Reading the content of the three links below willgive you an idea what i mean:
http://www.quickpdf.org/forum/dplsetformfieldvaluebytitlea-and-utf8_topic3632.html
http://www.quickpdf.org/forum/getpagetext4-returns-cryptic-characters_topic1914.html
https://www.debenu.com/docs/pdf_library_reference/SetAnsiMode.php




-------------
Cheers,
Ingo



Posted By: Ingo
Date Posted: 16 Apr 20 at 10:46AM
In the developer guide you should read the chapter:
Unicode, UTF-8 and the DLL and Delphi Editions



-------------
Cheers,
Ingo



Posted By: Ingo
Date Posted: 16 Apr 20 at 2:45PM
Hi Edgar,


if i look inside both pdf-files i can see that they were made with the same dev-code-syntax.

On the other side string handling was changed (directly after 7.26) from utf-8 to utf-16 to make it easier creating really global apps.

Now you'll need string to unicode conversion.

Your "cszansi2wide" seems to be a bit older?

It'll work with utf-8 but obviously not with utf-16.


Cheers, Ingo



-------------
Cheers,
Ingo



Posted By: eborger
Date Posted: 16 Apr 20 at 10:08PM
Thanks Ingo for pointing my in the right direction, the difference is UTF-16 instead of UTF-8, so I am converting from ANSI now using MultiByteToWideChar(), and the tricky part is that you have to use the correct codepage as one (the first) of the parameters in this function.

using MultiByteToWideChar(1257, etc, etc  ) works fine.

Thank you and stay safe.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk