X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=createpdf.pl;h=6147e7e1938fd63b811658f41fced6ad985f6853;hb=68190899b23c04803979149c4752bafb3cb0f4fb;hp=3d9afce4281ebbb08d83435602f4b2e06651d694;hpb=130810b91098f85be3763e727bd420d2107b1f81;p=webpdf diff --git a/createpdf.pl b/createpdf.pl index 3d9afce..6147e7e 100755 --- a/createpdf.pl +++ b/createpdf.pl @@ -29,6 +29,7 @@ $ENV{"HOME"} = $pdfweb::config::homedir; my $cgi = CGI->new; my $filename = $cgi->param('input'); my $file = $cgi->upload('input'); +my $url = $cgi->param('url'); # It kind of sucks that we just can't get the temporary file name from # CGI.pm, but OK, here goes :-) @@ -54,7 +55,14 @@ if ($cgi->param('preset') eq 'screen') { $psopts = ""; } -if ($filename =~ /(.*)\.(?:e?ps|pdf)$/i) { +if ($url =~ /^http/i) { + $outname = "web.pdf"; + + # Render through Gecko + $ENV{'DISPLAY'} = $pdfweb::config::xserver; + system("gnome-web-print", $url, "$pdfweb::config::outputdir/$pdf_filename.ps"); + system("gs $pdfopts -dCompatbilityLevel=1.4 -dNOPAUSE -dPATCH -sDEVICE=pdfwrite -dSAFER -sOutputFile=output/$pdf_filename -c '.setpdfwrite $psopts' -f - < $pdfweb::config::outputdir/$pdf_filename.ps >&2"); +} elsif ($filename =~ /(.*)\.(?:e?ps|pdf)$/i) { $outname = "$1.pdf"; # Yay, just a round through GhostScript