[Chicago-talk] Create PDF Recommendation
Leland Johnson
leland at protoplasmic.org
Wed Sep 30 18:33:34 PDT 2009
If it's just monospace plain text, you'd be best off starting with
that instead of the HTML. enscript does a decent job of outputting
monospace text to postscript. Use pstopdf or an equivalent to get the
postscript to PDF. You can also customize enscript's header and footer
extensively, or just use --fancy-header.
I've looked into making PDFs in Perl a while ago and discovered two
options: layout the content yourself with a module, or shell out to
something that does coversion for you. LaTeX, subpar HTML -> PDF
converters, etc. Things might have changed by now; a converter based
on WebKit would be worth investigating.
From the shell:
enscript --header "The Novel" --output - novel.txt | ps2pdf - novel.pdf
In Perl:
use strict;
use warnings;
use IPC::Run ();
my $content = "All work and no play make Jack a dull boy.\n" x 100;
my $header = 'The Novel';
my $pdf;
my $enscript_cmd = ['enscript', '--header', $header, '--output', '-'];
my $ps2pdf_cmd = ['ps2pdf', '-', '-'];
IPC::Run::run($enscript_cmd, \$content, '|', $ps2pdf_cmd, \$pdf);
print $pdf;
Leland Johnson
On Sep 30, 2009, at 11:28 AM, Jim Jacobus <jim.jacobus at gmail.com> wrote:
> Can anyone recommend an easy way to create PDFs? I want to supply a
> report to customers as either a HTML for or PDF. File I am creating
> is simple, no graphics, single column, monospaced characters.
> I was going to use PDF-Create-1.04 , but with it I have to do a lot
> of work like keeping track of page breaks and such. I've done that
> before, but I was hoping there would be something easier since I can
> start with an HTML. Ideally, it would work like the print preview in
> the Firefox browser--in other words it would work like a print
> driver. Any ideas? Thanks in advance.
> _______________________________________________
> Chicago-talk mailing list
> Chicago-talk at pm.org
> http://mail.pm.org/mailman/listinfo/chicago-talk
More information about the Chicago-talk
mailing list