From 130810b91098f85be3763e727bd420d2107b1f81 Mon Sep 17 00:00:00 2001
From: "Steinar H. Gunderson"
Date: Sun, 7 Aug 2005 22:17:50 +0000
Subject: [PATCH] Back out the OO.o native file formats. It seems OO.o likes to
be really unpredictable in naming of the output PostScript when running
native, and it's really not that useful.
---
createpdf.pl | 12 ++++++++++--
index.html | 7 ++-----
2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/createpdf.pl b/createpdf.pl
index 9ee7aa9..3d9afce 100755
--- a/createpdf.pl
+++ b/createpdf.pl
@@ -90,7 +90,7 @@ if ($filename =~ /(.*)\.(?:e?ps|pdf)$/i) {
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;
@@ -106,7 +106,15 @@ if ($filename =~ /(.*)\.(?:e?ps|pdf)$/i) {
# 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;
diff --git a/index.html b/index.html
index 268ba2e..beb72c8 100644
--- a/index.html
+++ b/index.html
@@ -83,8 +83,7 @@
BMP (.bmp), PNG (.png), JPEG (.jpg/.jpeg), XPM (.xpm), via ImageMagick.
Microsoft Word (.doc), Excel (.xls) and PowerPoint (.ppt), via
OpenOffice.org (could be
- slightly sketchy at times, let me know if it's broken), plus matching native
- OpenOffice.org formats.
+ slightly sketchy at times, let me know if it's broken).
Lots of different programming-related formats (.c, .pl, .js, etc.),
via Vim.
@@ -92,9 +91,7 @@
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
- Dynalivery's headless Gecko
- demo for a free-as-in-beer service for rendering HTML to PDF.)
+ missing. :-)
Source code
--
2.39.2