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 = "
";
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;