Hi,if I understand the documentation (https://partners.adobe.com/public/developer/en/pdf/PDFReference13.pdf) right, it should be possible to contain in the Latin Character Set in a PDF, also with fpPDF (which uses WinAnsiEncoding) and also with standard fonts.
These characters are shown in table D.1 Latin Character Set and Encodings on page 551 of the documentation.
If I now try to insert such characters, they aren't shown right in the created PDF (Adobe Reader XI, 64bit Windows 7, 32bit Lazarus 1.7 r52225 FPC 3.1.1 r33528 i386-win32-win32/win64).
Simple try these steps to understand, what I mean:- open Example "testfppdf" and add Run Parameters "-p 1" to only create the first page. - add in the Source Editor in "testfppdf.lpr" line 139 some of the Latin Characters:
P.WriteText(25, 20, 'Sample Text AÆÁÂÄÀÅÃBCÇDEÉÊËÈЀ'); - run your app and see the result (Adobe Reader XI, 64bit Windows 7): Sample Text A???????BC?DE????? If I convert the string to a UTF8-encoded one, the result is: Sample Text AÆÁÂÄÀÅÃBCÇDEÉÊËÈЀ(I also eliminated FtText1 := D.AddFont('FreeSans.ttf', 'FreeSans', clGreen); and the lines after line 139 to reduce the size of the attached PDFs, the result is the same)
I add the two PDFs (one with ACP encoding, one with UTF-8 encoding) to show you the results. I also add "UTF8_Encoded_PDFString.patch" to show you, what I have done.
I'm not sure, if this workaround is valid or there is a better solution. Please have a look at it.
Thank you Kind regards Michl
test_ACP.pdf
Description: Adobe PDF document
test_UTF8.pdf
Description: Adobe PDF document
Index: packages/fcl-pdf/src/fppdf.pp =================================================================== --- packages/fcl-pdf/src/fppdf.pp (revision 33528) +++ packages/fcl-pdf/src/fppdf.pp (working copy) @@ -2380,6 +2380,7 @@ FValue := AValue; if (Pos('(', FValue) > 0) or (Pos(')', FValue) > 0) or (Pos('\', FValue) > 0) then FValue := InsertEscape(FValue); + SetCodePage(RawByteString(FValue), CP_UTF8, True); end; { TPDFUTF8String }
-- _______________________________________________ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus