Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: Html to PDF convertor

by rbi (Monk)
on Sep 20, 2006 at 15:59 UTC ( #573922=note: print w/replies, xml ) Need Help??

in reply to Html to PDF convertor

I've installed html2ps, written in Perl, and Ghostscript that has the ps2pdf utility.
then you could do something like:
my $HTML2PS = '/usr/local/bin/html2ps -L'; my $PS2PDF = '/usr/bin/ps2pdf'; my $plot_file_base = 'whatever'; # First create an HTML file (or slurp it from file) my $h2p = "<html><head></head><body> <img src=$pngfile> </body></html>"; my $file_to_ps = $plot_file_base.'_to_ps.htm'; open (FH,">$file_to_ps") or die "cannot open $file_to_ps: $!\n"; print FH $h2p; close(FH); # Then create a ps file my $file_ps = $plot_file_base.'.ps'; system "$HTML2PS $file_to_ps > $file_ps"; #And finally convert it to PDF my $file_pdf = $plot_file_base.'.pdf'; system "$PS2PDF $file_ps $file_pdf"; unlink $file_to_ps; unlink $file_ps;
Hope this can help.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://573922]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2017-01-23 13:12 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (192 votes). Check out past polls.