This document briefly describes implementing national characters support in PDF files from Progress 4GL using a tool PDF Include. However a general idea concerns PDF format and might be implemented in any other tool that generates PDF.
It is possible to use True type font in PDF but embedding TT font add extra 300KB to final PDF document. If you want to generate a single page and send it to 100 000 customers by email then such difference is important.
Update!!! It's not working with Courier, just Times-Roman and Helvetica.
To change standard fonts you must put national characters definitions below line:
/BaseEncoding /WinAnsiEncoding
For Polish characters in win-1250 encoding it looks like:
/BaseEncoding /WinAnsiEncoding /Differences [ 143 /Zacute 159 /zacute 140 /Sacute 156 /sacute 202 /Eogonek 234 /eogonek 198 /Cacute 230 /cacute 209 /Nacute 241 /nacute 211 /Oacute 243 /oacute 163 /Lslash 179 /lslash 165 /Aogonek 185 /aogonek 175 /Zdotaccent 191 /zdotaccent ]
Syntax is:
ascii_code /glymph_name
It's enough to replace ASCII codes with proper national characters. Usually there's another problem with proportional fonts: Times-Roman and Helvetica. Replaced characters might have different width than original so your text might looks bad. To solve that you must provide width definition for standard fonts: it's not possible to define width for just few characters - at least I don't know how to do it.
Have a look at differences between two files:
pdf.pdf - regular PDF file
pdf_pl.pdf - the same file with replaced Polish characters
You might save them and use some kind of diff utility to find out differences as PDF is a text file.
Mind that it works in new versions of Acrobat Reader. As far as I know Times-Roman with replaced characters is handled properly from version 5, Helvetica from version 6.
I've also:
- commented out annoying message in pdf_set_GraphicX and pdf_set_GraphicY
- added a new parameter ColumnVerticalPadding used in modified pdftool.p
RUN pdf_new_page("Spdf").
RUN pdf_set_base14_codepage("Spdf", SESSION:CPINTERNAL ).
Remember to use encoding from SESSION:CPINTERNAL because pdf_inc.p opens stream as "binary no-convert". You might have a look at the example pdf_pl_1250.p - this procedure creates pdf_pl.pdf mentioned above.
Determining - so called - glymph names for your national characters might be difficult sometimes. My suggestion is:
- find out your encoding at http://www.kostis.net/charsets
- check ISO/UTF8 character name
- find that name on adobe.com, using advanced search in Google (works better than search engine on adobe.com)
For example: I want to find out glymph name for letter in win-1250 encoding
- I open this encoding: http://www.kostis.net/charsets/cp1250.htm
- ISO/UTF8 name is "LATIN CAPITAL LETTER A WITH OGONEK"
- I use Google: http://www.google.com/search?as_q=LATIN+CAPITAL+LETTER+A+WITH+OGONEK&as_sitesearch=adobe.com
- glymph name is "Aogonek" (mind that names are case sensitive)
Enjoy!
Tomasz Judycki