in reply to Dynamically generated HTML to PDF
So after trying to manually convert the HTML to PDF I went for the easy route, I used htmldoc which gets a web page and converts it to Postscript, then I use Ghostscript (ps2pdf) to make the PDF.
This worked good for me, cause I then needed to get more then one quote, so with a loop around the htmldoc and keep appending to the same output file, I got a PDf with all my needed pages.
Code Snippet I used (yea, it's not the best, but it's early code for me):
Now $tmp2 is my PDF file.$tmp="$TMP_DIR/"."Quotes$$"."$USTATUS{USERNAME}.ps"; $htmp="$HTMP_DIR/"."Quotes$$"."$USTATUS{USERNAME}.pdf"; $tmp2=$tmp; $tmp2=~s/\.ps$/\.pdf/gi; `>$tmp`; my $ctr=0; my $tlog="$Q::all_quotes"; $tlog=~s/:/ /g; &logme('Quotes-PDF', "Getting PDF for quotes $tlog"); print "Processing quotes "; foreach $id (reverse split /:/, $Q::all_quotes) { $ctr++; print " $id "; `htmldoc -t ps --header '' --no-numbered --size letter --bodycolo +r white --left .5in --right .5in --webpage "http://localhost/cgi-bin +/po/index.cgi?session=$SESSION&user=$USTATUS{USERNAME}&qdetail=$id&no +ip=noip" >> $tmp`; } `ps2pdf $tmp $tmp2`;
ronzo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Dynamically generated HTML to PDF
by menolly (Hermit) on Sep 26, 2003 at 21:40 UTC | |
by ronzomckelvey (Acolyte) on Sep 26, 2003 at 21:56 UTC |