PDF::Reuse & UK currency "pound" symbol
am 29.11.2007 14:12:39 von 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.
--
Justin C, by the sea.
Re: PDF::Reuse & UK currency "pound" symbol
am 29.11.2007 16:43:22 von Ben Morrow
Quoth justin.news@purestblue.com:
> 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