This bash function uses pod2pdf to produce a very nice san-serif font PDF with title and footer and opens it with the "open" command (for OSX, adjust as needed). The tempfile is necessary for the PDF reader (Preview) to have a filename should one choose to save the file as, for example: "perldoc -q array.pdf". pod2pdf seems to call PDF::API2 about 10,000 times per page so it's slow on large documents
Type perlpdx instead of perlpdf!function perlpdf() { P=perldoc; X="$P $@"; $P -uT "$@" | pod2pdf --title="$X" --footer-text="$X" > "/tmp/$X.pdf"; open "/tmp/$X.pdf"; }
This one uses ghostscript ps2pdf via man via pod2man to produce a plainer looking serif font PDF with a more generic title and footer (perl version/date/etc) and a filename. It seems more complicated but the process is extremely fast.
function perlpdx(){ P=perldoc; $P -uT "$@" | pod2man > "/tmp/$P $*.1"; man -t "/tmp/$P $*.1" | ps2pdf - "/tmp/$P $*.pdf"; open "/tmp/$P $*.pdf"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: perlpdf for perldoc as PDF
by Anonymous Monk on Jun 02, 2018 at 23:41 UTC |