in reply to PDF::API2 Paragraphs and Overflow Text
The docs (and the source) suggests that the overflow text is simply the return value of the paragraph() method. Have you tried
my $overflow_text = $txt->paragraph("$paragraph", 40 /mm, 70, align => + "left" );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: PDF::API2 Paragraphs and Overflow Text
by dickieb (Initiate) on Sep 03, 2009 at 11:02 UTC | |
Dear Almut - Thank you very much for your reply. It has worked I now have another question relating to the PDF::TextBlock module which can also be used to create nice paragraphs in PDFs .Firstly I have altered the code of the TextBlock.pm module at line 376
to return the overflowed text from TextBlock.pm to my script .This overflow text is then placed into a second block by my script My entire script for this is :-
However the second block containing the overflow text is on a second page I have 2 questions. 1. There is a method or reference in the TextBlock.pm file for specifing which page to put the block of text on but what do I need to type in my script to access this method and put all the text blocks on page 1 or 2 etc? 2. Would it be possible to alter the TextBlock.pm to change the colour of the text especially inside the 'markup' tags (so hyperlinks could appear blue or bold text appear red etc)? If this is not possible could one specify the colour of an entire text block Thank you in advance for your help | [reply] [d/l] [select] |
by almut (Canon) on Sep 03, 2009 at 14:28 UTC | |
1. There is a method or reference in the TextBlock.pm file for specifing which page to put the block of text on but what do I need to type in my script to access this method and put all the text blocks on page 1 or 2 etc? This isn't documented, but if you look in the source, you'll find
That is, if you supply an existing page to the constructor like this
then PDF::TextBlock won't create a new one itself within the apply() method. (you have to pass the same $page to the other constructor as well, of course, if you want both blocks to appear on the same page...) 2. Would it be possible to alter the TextBlock.pm to change the colour of the text especially inside the 'markup' tags (so hyperlinks could appear blue or bold text appear red etc)? If this is not possible could one specify the colour of an entire text block For tags other than href you just have to define a fillcolor for the custom font that you're setting for the specific tag. E.g. for <b>:
An analogous approach for hyperlinks, such as
unfortunately doesn't work out of the box... For one, because the href tag undergoes special built-in handling (underlining, link annotation, ...). Secondly, because the regex that's being used to filter out the tags is extracting the entire part in between <...> - i.e. href="http://www.omnihotels.com" in your case - so you'd have to define a separate custom font object for each and every link:
Probably not what you want... Anyway, here's a quick hack that seems to do the job (i.e. you can then use the above mentioned href => ... font definition similiarly to b => ..., etc. In case you need more functionality, it's probably time to get in contact with the author of the module... :) The complete diff is (your patch included (the last section)):
| [reply] [d/l] [select] |
by dferret (Initiate) on Oct 21, 2009 at 16:51 UTC | |
| [reply] [d/l] |
by dickieb (Initiate) on Sep 03, 2009 at 14:37 UTC | |
Many thanks once again Almut - I will study and try it out :| | [reply] |