Printing Perl documentation

Tags:

Why? There's still nothing like printed documentation when you're learning a new subject. Or perhaps you'd like a PDF document to view on your tablet.

Here's the quickest way to create a PDF from any Perl documentation on your system. For example, let's do the CPAN module SQL::Abstract:

pod2pdf --pagesize=letter `perldoc -l SQL::Abstract`       > /tmp/SQL_Abstract.pdf`

Now you can view or print that. I find print 2-up pages, double-sided (4 total pages per sheet) is a handy and space-saving yet still readable. You might find it useful to reduce the PDF margins and let evince or okular manage the actual 2-up physical margins later:

pod2pdf --margins 18 --pagesize=letter       `perldoc -l SQL::Abstract` > /tmp/SQL_Abstract.pdf

The margins parameter is in printer's points (1/72 inch) and 18pt = ┬╝inch (0.635cm). You can also specify --left-margin as well as right, top, and bottom margins individually.

When printing several PDFs together, you may want to suppress blank pages. This is important when using double-sided or 2-up printing. To join several PDFs together for printing, you can use:

pdfunite a-in.pdf b-in.pdf output.pdf

If you are having difficulty printing documentation that contains Unicode,

 cpanm App::pod2pdf Paper::Specs