In order to create PDFs I've installed
html2ps, written in Perl, and
Ghostscript that has the ps2pdf utility.
And then I do something like this in my CGI appplications:
my $HTML2PS = '/usr/local/bin/html2ps -L';
my $PS2PDF = '/usr/bin/ps2pdf';
# First create an HTML file that I want to print
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;
It's under Linux, but will probably work under other OSs. Hope this helps.
Ciao, Roberto