PDF::Reuse & UK currency 'pound' symbol

J

Justin C

I'm trying to print a 'pound' symbol (the UK currency, not a # or
anything else that may get called pound) to a PDF document in
PDF::Reuse. I've a string containing the symbol in a variable, and am
printing it thus:
$txt = "The cash value is £"; # not sure how that'll appear on usenet
prText($x, $y, $txt) ;

The output I'm seeing is a capitalised A with a caret followed by the
pound symbol. I'm not sure how to proceed. Looking at UTF8, I can find
the code for the character I want, but, looking at documentation for the
utf8 module I see: "Do not use this pragma for anything else than
telling Perl that your script is written in UTF-8" ... which it isn't, I
just want to print one symbol.

Any suggestions how I might move forward with this? Thank you for any
help you can give.

Justin.
 
B

Ben Morrow

Quoth (e-mail address removed):
I'm trying to print a 'pound' symbol (the UK currency, not a # or
anything else that may get called pound) to a PDF document in
PDF::Reuse. I've a string containing the symbol in a variable, and am
printing it thus:
$txt = "The cash value is £"; # not sure how that'll appear on usenet
prText($x, $y, $txt) ;

The output I'm seeing is a capitalised A with a caret followed by the
pound symbol. I'm not sure how to proceed. Looking at UTF8, I can find
the code for the character I want, but, looking at documentation for the
utf8 module I see: "Do not use this pragma for anything else than
telling Perl that your script is written in UTF-8" ... which it isn't, I
just want to print one symbol.

Actually, it probably is. If you have a literal £ as you wrote it up
there, then your document is in UTF8.

You should probably use the encoding pragma rather than the utf8 pragma:
it's more robust on bad input.
Any suggestions how I might move forward with this? Thank you for any
help you can give.

I strongly suspect this won't help, though :(. prText simply inserts the
text into the PDF as a PDF text literal, and I don't think PDF
understands literals in UTF8. You need to locate the £ character in
whatever font you are using and arrange to output that character
instead; simply converting your (now) Unicode perl string into an
ISO8859-1 byte string using Encode::encode may be sufficient, if you're
lucky.

Ben
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,905
Latest member
Kristy_Poole

Latest Threads

Top