Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^3: PDF::API2 Questions

by Eliya (Vicar)
on Mar 15, 2012 at 10:35 UTC ( [id://959764]=note: print w/replies, xml ) Need Help??


in reply to Re^2: PDF::API2 Questions
in thread PDF::API2 Questions

Some of the data is blocks of text...

Don't know whether you've already come across PDF::TextBlock (based on PDF::API2) — it can make life easier with respect to automatic text wrapping/justification, etc.

Replies are listed 'Best First'.
Re^4: PDF::API2 Questions
by akwe-xavante (Acolyte) on Mar 16, 2012 at 09:58 UTC

    I'm my question is a really silly but i have my problem that i've failed to resolve even after googling it a number of times

    How on earth do you get a correct £ character into a PDF document without letter A in front of it?

    How do get all the special characters even?

      How do get all the special characters even?

      Primarily, you need a font that supports the desired character(s) (= does have a glyph for it).  And with characters outside of the Latin-1 range ('£' is not one of them), you want to use Unicode, which (according to my tests) means you can't use the core fonts any longer, but need to switch to using TrueType fonts, for example (see also Re^2: PDF::API2 / unicode characters).

      Depending on where the special characters are coming from - i.e. from literal strings within the source, from files outside of the program, etc. - you need to use utf8 (when your source is UTF-8 encoded), and maybe use feature 'unicode_strings' (avoids a number of more subtle legacy issues and ambiguities with Perl's handling of Unicode (works with newer perls only)), and/or set the PerlIO encoding layer correctly for the respective file handles that the special character are read from.

      As for the letter A in front of £ (I suppose you really meant Â), the problem most likely is that your source code is in UTF-8, but you did not tell Perl about it (see paragraph above) — the UTF-8 encoding of the pound sign is the two bytes \xc2 \xa3, which when incorrectly interpreted as two Latin-1 characters, renders as '£'.

Re^4: PDF::API2 Questions
by akwe-xavante (Acolyte) on Mar 16, 2012 at 10:02 UTC

    I'm my question is a really silly but i have my problem that i've failed to resolve even after googling it a number of times.

    How on earth do you get a correct £ character into a PDF document without letter A in front of it?

    How do get all the special characters even?

      Thank you, adding use utf8 sorted it for me

      Thank you

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://959764]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2024-04-25 14:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found