--- pdfroff.orig Sat May 27 21:52:40 2006 +++ pdfroff Fri Jun 16 21:38:24 2006 @@ -145,6 +145,7 @@ help reference-dictionary no-reference-dictionary stylesheet pdf-output no-pdf-output version report-progress no-toc-relocation + emit-ps " # Parse the command line, to identify 'pdfroff' specific options. # Collect all other parameters into new argument and file lists, @@ -230,6 +231,10 @@ normally required to position the table of contents at the start of a PDF document. + --emit-ps + Emit PostScript output instead of PDF. + Useful for postprocessors such as gpresent. + ETX exit 0 ;; @@ -266,6 +271,10 @@ --no-toc-relocation) TC_DATA="" TOC_FORMAT="" BODY_FORMAT="" ;; + + --emit-ps) + EMIT_PS="YES" + ;; # # any other non-null match must have matched more than one defined case, # so report the ambiguity, and bail out. @@ -549,22 +558,34 @@ # PostScript intermediate files into a single PDF output file. # $SAY >&2 $n "Writing PDF output ..$c" - PDFWRITE="$GS -dQUIET -dBATCH -dNOPAUSE -sDEVICE=pdfwrite" + if test -n "$EMIT_PS" + then + if test -n "$PDF_OUTPUT" + then + $SAY >&2 $n ".\nWARNING: --pdf-output is ignored with --emit-ps ..$c" + fi + PDFWRITE="$CAT" + ERASE_BLANK_PAGES_SCRIPT='' + else + PDFWRITE="$GS -dQUIET -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=${PDF_OUTPUT-'-'}" # # (This 'sed' script is a hack, to eliminate redundant blank pages). # - $SED ' - :again - /%%EndPageSetup/b finish - /%%Page:/{ - N - b again - } - b - :finish - N - /^%%Page:.*0 *Cg *EP/d - ' $TC_DATA $BD_DATA | $PDFWRITE -sOutputFile=${PDF_OUTPUT-"-"} $CS_DATA - + ERASE_BLANK_PAGES_SCRIPT=' + :again + /%%EndPageSetup/b finish + /%%Page:/{ + N + b again + } + b + :finish + N + /^%%Page:.*0 *Cg *EP/d + ' + fi + + $SED "$ERASE_BLANK_PAGES_SCRIPT" $TC_DATA $BD_DATA | $PDFWRITE $CS_DATA - $SAY >&2 ". done" # # ------------------------------------------------------------------------------