On Fri, Jun 16, 2006 at 03:03:25PM +0100, Keith Marshall wrote: > Thanks for suggesting this potential enhancement. I think, however, that > I prefer `--emit-ps', or `--emit-postscript', (one or the other, but not > both, otherwise abbreviation becomes unwieldy), to your choice of > `--leave-postscript-output', for the name of the new option.
I agree. > One problem I do see, with your patch, is that it always assumes that > `--no-toc-relocation' is the desired behaviour; this may not always be > the case. Better to define `PDFWRITE="$CAT"', rather than its normal > `PDFWRITE="$GS ..." definition, if `--emit-ps' is specified, I think. Well, the patch was for my personal use, and since gpresent generates TOC for the slides I never really needed that feature. However, I agree that in general case it should be considered. The new patch and the patch to the man page are attached. One issue I had is that your sed script erased completely valid EPS files (created by ImageMagick convert program from JPG and PNG) embedded in my presentations. Thus I decided to make it an empty script for --emit-ps option. If you ever fix it, so that it doesn't remove images, but rather blank pages only, it could be used without if-else-fi. Till then, I think it is safer to assume that a user of --emit-ps wants an unchanged PostScript output. I'd fix that sed script myself if I had a faintest idea how to reliably distinguish a valid embedded EPS from a blank page. > I also note that you've added the `-dSAFER' option to the `gs' invocation. > I'd prefer not to do that, as not all users may want it. Better to add a > `--gs-options="option list"' option to pdfroff, so that users can make > the choice, IMHO. (This is something which was discussed before, but I > simply haven't found the time to implement it). No need. I call it from Makefile as env GS_OPTIONS="-dSAFER" pdfroff ... Ghostscript respects GS_OPTIONS environment variable. Best regards, Zvezdan Petkovic
--- 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" # # ------------------------------------------------------------------------------
--- pdfroff.1.orig Sat May 27 21:52:40 2006 +++ pdfroff.1 Fri Jun 16 18:49:57 2006 @@ -96,6 +96,7 @@ .opta T dev .opta w name .opta W name +.opt -emit-ps .opt -no-toc-relocation .opte -stylesheet name .optx -pdf-output name @@ -284,6 +285,15 @@ .B pdfroff to display a summary of the its usage syntax, and supported options, and then exit. +.TP +.B \-\-emit-ps +Instructs +.B pdfroff +to emit PostScript output instead of PDF. +This option is useful when pdfroff is used together with other groff +postprocessors, such as +.IR gpresent , +which expect a PostScript input. .TP .B \-\-no\-pdf\-output May be used with the
_______________________________________________ Groff mailing list Groff@gnu.org http://lists.gnu.org/mailman/listinfo/groff