]> git.sesse.net Git - webpdf/commitdiff
Back out the OO.o native file formats. It seems OO.o likes to be really unpredictable...
authorSteinar H. Gunderson <sesse@samfundet.no>
Sun, 7 Aug 2005 22:17:50 +0000 (22:17 +0000)
committerSteinar H. Gunderson <sesse@samfundet.no>
Sun, 7 Aug 2005 22:17:50 +0000 (22:17 +0000)
createpdf.pl
index.html

index 9ee7aa92985d66be94b0d7573ea709ef2b5390de..3d9afce4281ebbb08d83435602f4b2e06651d694 100755 (executable)
@@ -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;
index 268ba2e49b0928b668d7fc4e67c83013b0fba832..beb72c84da333b4836c6f876a07521c64e7bf64a 100644 (file)
@@ -83,8 +83,7 @@
       <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>
@@ -92,9 +91,7 @@
     <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>