print PIPE $buf;
}
close PIPE;
-} elsif ($filename =~ /(.*)\.(doc|xls|ppt|sxw|sxc|sxi)$/i) {
+} elsif ($filename =~ /(.*)\.(doc|xls|ppt)$/i) {
$outname = "$1.pdf";
my $ext = $2;
# Create PostScript from OOo :-)
system("/usr/lib/openoffice/program/soffice -display $pdfweb::config::xserver -headless -pt pdf $pdfweb::config::outputdir/$pdf_filename.$ext");
- system("gs $pdfopts -dCompatbilityLevel=1.4 -dNOPAUSE -dPATCH -sDEVICE=pdfwrite -dSAFER -sOutputFile=output/$pdf_filename -c '.setpdfwrite $psopts' -f - < output/$pdf_filename.$ext.pdf >&2");
+ # This is quite hideous -- it looks like OO.o calls the file something slightly
+ # different depending on the time format, phase of the moon or something... So
+ # we try both.
+ my $inp_ps = "output/$pdf_filename.$ext.pdf";
+ if (! -r $inp_ps) {
+ $inp_ps = "output/$pdf_filename.pdf";
+ }
+
+ system("gs $pdfopts -dCompatbilityLevel=1.4 -dNOPAUSE -dPATCH -sDEVICE=pdfwrite -dSAFER -sOutputFile=output/$pdf_filename -c '.setpdfwrite $psopts' -f - < $inp_ps >&2");
} elsif ($filename =~ /(.*)\.(c|cc|cpp|cs|h|py|rb|pl|diff|patch|js|php[1-5]?|hs|f|f90|java|css|sql|l|y|s?ml|sh|awk|m|v)$/i) {
$outname = "$1.pdf";
my $ext = $2;
<li>BMP (.bmp), PNG (.png), JPEG (.jpg/.jpeg), XPM (.xpm), via <a href="http://www.imagemagick.com">ImageMagick</a>.</li>
<li>Microsoft Word (.doc), Excel (.xls) and PowerPoint (.ppt), via
<a href="http://www.openoffice.org">OpenOffice.org</a> (could be
- slightly sketchy at times, let me know if it's broken), plus matching native
- OpenOffice.org formats.</li>
+ slightly sketchy at times, let me know if it's broken).</li>
<li>Lots of different programming-related formats (.c, .pl, .js, etc.),
via <a href="http://www.vim.org/">Vim</a>.</li>
</ul>
<p>If somebody knows a good way of getting a Gecko-based browser to
convert from an URL or HTML file to PostScript (on the command line),
please let me know; I'd guess HTML would be the most-wanted format
- missing. :-) (You may want to try out
- <a href="http://gecko.dynalivery.com/">Dynalivery's headless Gecko
- demo</a> for a free-as-in-beer service for rendering HTML to PDF.)</p>
+ missing. :-)</p>
<h2>Source code</h2>