Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

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.


Comment on Re: Html to PDF convertor
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://573922]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2014-09-20 17:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (160 votes), past polls