Re: Re: Paragraph and documentation
"Mr. Shawn H. Corey" <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.pdfapi2 |
|---|---|
| Message-ID | <[email protected]> |
spinningwebz2002 wrote:
> Probably Variables is the wrong word. What I was thinking, if I have
> to write routines to use the text->text for bold, italic etc, then it
> would be necessary to know where the line ended so that the next
> block of text would start after it.
Try $text->textpos;
>
> For the time being I am using text->paragraph and setting it up so it
> is only one line long, this way I get what was overflowed back and
> then create the next line below it until all text is done displaying.
> I did this so I can catch when I reach the bottom of the page and add
> a new page. It will also allow me to do things like wrap text around
> a photo, have varying line width etc.
>
> Ideally what I think I may end up doing is rewriting the text-
>> paragraph as my own routine that would catch simple html markup
> (<B><I><U><UL> etc) in a line and handle it automatically.
Hardly simple since you would have to use an HTML parser. It would be
better if you used a Perl structure. Each paragraph could be an array
of hashes. For example:
my $paragraph = [
{
bold => 0,
italic => 0,
underline => 0,
text => 'This is plain text. ',
},
{
bold => 1,
italic => 0,
underline => 0,
text => 'This is bold text. ',
},
];
>
> One thing I notice is that it takes pdf::api2 a bit to get started,
> is this due to the use strict;? If so, when my code is done can I
> remove that to speed up the process? Or, will the pdf::api2 run under
> mod_perl?
I have never tried PDF::API2 with mod_perl. Let me know how it goes.
PDF::API2 takes a long time to load since it has a lot of fonts. Most
of their metrics are not loaded until you actually use a font; some of
the delay you see is the loading of the font metrics you do use. In
other words, it's just big.
--
Just my 0.00000002 million dollars worth,
Shawn
"For the things we have to learn before we can do them, we learn by
doing them."
Aristotle