in reply to Re^2: PDF::Create - help with tabulation
in thread PDF::Create - help with tabulation

flexvault:

I'm not familiar with PDF::Create, either. I briefly looked over the docs, and it looks like the println method might be enough. It doesn't mention tab expansion, so I don't know if the same problem would occur or not.

There's a reference to a set width method, too, so it may let you set line length and do auto wrapping. But I haven't actually tried using it.

...roboticus

When your only tool is a hammer, all problems look like your thumb.

UPDATE: I went ahead and installed it and gave it a quick try:

#!/usr/bin/perl # # example for PDF::Create # use 5.14.0; use warnings; use autodie; use PDF::Create; my $txt=<<EOT; Here's a little bit of text that contains a very long line followed by + a few short ones so we can see which method(s) may or may not handle + wrapping and embedded newlines, just in case any of them do. Though\tprintnl\tshould\thandle embedded newlines just fine. EOT my $pdf = new PDF::Create('filename'=>'foo.pdf'); my $a4 = $pdf->new_page('MediaBox'=>$pdf->get_page_size('A4')); my $page = $a4->new_page; my $f1 = $pdf->font('BaseFont'=>'Helvetica'); $page->string($f1, 12, 72, 600, $txt); $page->printnl($txt, $f1, 12, 72, 400); $pdf->close;

The result: neither the string nor printnl methods will do autowrapping or any sort of tab expansion other than treating the tabs as spaces (unless my brief scan of the docs missed an option somewhere). The printnl function will at least handle \n nicely.

Replies are listed 'Best First'.
Re^4: PDF::Create - help with tabulation
by flexvault (Monsignor) on Jul 20, 2012 at 11:36 UTC

    roboticus,

    Sorry to put you through all that work, I was just wondering if when creating the object there was a command / parameter to define margins and spacing.

    PDF is a standard, but it's more like coding in machine language versus working with Perl.

    Thank you

    "Well done is better than well said." - Benjamin Franklin

      "Heh ... one man's work is another man's relaxation. I did it only because you mentioned the module and it looked interesting enough to give it a try."

      Any good at painting and decorating!

        Gavin:

        I find painting rooms relaxing too. But you're probably not local .... ;^)

        As far as decorating .... you'd probably be best to reconsider, unless you like "early american Hamfest", or "tech tornado". (Seriously, my place is full of random technical junk. It looks like a tornado picked up the Dayton hamvention and dropped it onto my house. If I could move all this stuff out of the way, I could paint my place instead of all my friends places.

        Update: Fixed salutation--For some reason, I was on automatic. I apparently thought I was replying to some bloke named "roboticus", rather than Gavin.

        ...roboticus

        When your only tool is a hammer, all problems look like your thumb.

      flexvault:

      Sorry to put you through all that work

      Heh ... one man's work is another man's relaxation. I did it only because you mentioned the module and it looked interesting enough to give it a try.

      Yeah, PDF is kind of amusing... a combined platform and language. I get dragged into it every once in a while. I keep thinking I should learn PostScript, but no-one has waved any money at me, and it's not interesting enough yet to rise high enough on my "list of interesting things to do" for me to dig into it. Typically my exposure to it is just enough to remind me of it, and I learn just enough to get the current job done, and then forget about it for another year or two...

      ...roboticus

      When your only tool is a hammer, all problems look like your thumb.

Re^4: PDF::Create - help with tabulation
by julio_514 (Acolyte) on Jul 23, 2012 at 23:06 UTC
    Got it - Thanks all for the info and insights!