Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re: How to create beautiful PDF from Pod

by tobyink (Abbot)
on Oct 26, 2012 at 13:53 UTC ( #1001084=note: print w/replies, xml ) Need Help??

in reply to How to create beautiful PDF from Pod

I'd go with your current solution, but swap out Opera in favour of the Python xhtml2pdf library. No, you don't need to learn Python; it's bundled with a command-line script.

Or instead of xhtml2pdf, wkhtmltopdf.

perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'
  • Comment on Re: How to create beautiful PDF from Pod

Replies are listed 'Best First'.
Re^2: How to create beautiful PDF from Pod
by Tux (Abbot) on Oct 28, 2012 at 14:50 UTC

    The pyhton stuff installed but failed due to missing dependency. I didn't want to pursue that.

    The wkhtmltopdf solution works quite well. The perl module around it sucks, as it does not offer any features beyond the program itself. I would have hoped for it to support streaming (piped input, piped output), but all it does is pass the arguments to the system command. I can do that myself.

    Pod::Html shows its age. Not well thought through, sadly. Even if one uses local *STDOUT;, there is no way to get its output caught. This module also doe not support piping/streaming.

    I ended up with the code below (feel free to use, alter or comment on), where I still note a few drawbacks

    • Page wraps are unclean. On many page breaks the top half of a line is on the end of one page, the bottom half is on the next
    • CSS like text-align: justify; doesn't work very well.

    Enjoy, Have FUN! H.Merijn
      potyl's work with HTML → Webkit → Cairo → PDF is super-sweet: CPAN, Github. There's lots of example code strewn around, check every distro/repository that looks related/has the keywords in the name.

      As of 2012, this is the most modern and formidable solution.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1001084]
[Discipulus]: the most common in Eataly, for males is to touch twice his own balls

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2018-04-26 09:49 GMT
Find Nodes?
    Voting Booth?