Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
I've googled, I've super-searched, yet I still can't find a working solution to a character set problem.

I have accented characters (á, for example) stored in a mysql database. HTML rendering is fine without converting the characters to HTMLEntities, but when I try to create a PDF with the same data and PDF::Template, I get a mangled "~Aj" combination.

From this google groups thread, setting a pdf_encoding in the xml template would be sufficient, e.g.:

<pdftemplate name="masterList" pdf_encoding='ISO-8859-1'>

But when I add pdf_encoding to my template, I get the following error:

PDFlib Error [1552] PDF_findfont: Font 'Helvetica' with encoding 'ISO-8859-1': Couldn't find encoding 'ISO-8859-1'

I've tried 'latin1', 'iso-8859-1', and 'utf-8' as valid encodings, but each one throws the above error (with the encoding substituted, of course).

I'm presuming the error is with PDFlib (it's throwing the error), but I'm hoping someone here has dealt with the same (or similar) issue and can give me a pointer or two.

EDIT 1) condensed template.xml

<pdftemplate name="masterList" pdf_encoding='iso8859-1'> <pagedef PAGE_WIDTH="612" PAGE_HEIGHT="792"> <font face="Helvetica" h="10"/> <LOOP NAME="ROWS"> <section> <row x='30' h="20"> <LOOP NAME='COLUMN'> <textbox w="50%"><VAR NAME="FIRST_NAME"/> <VAR NAME="LAST_NAM +E"/></textbox> </LOOP> </row> </section> </LOOP> </pagedef> </pdftemplate>
The template is just fed the needed (nested) array of hashrefs to properly populate the VARs

In reply to PDF::Template and character encodings by geektron

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (4)
As of 2021-12-05 03:03 GMT
Find Nodes?
    Voting Booth?
    R or B?

    Results (31 votes). Check out past polls.