pstops number-up with incorrect last page
Markus Durzinsky
mardur at gmx.net
Fri Jan 4 06:01:31 PST 2008
The pstops filter is producing incorrect output with number-up=2 on some documents.
I use cups 1.3 r7167 compiled with Sun Studio 11 on a sparcv8, Solaris 9. On some ps-files (e.g. created by the cups pdftops filter, or some latex-beamer-presentations) with an odd number of pages and printed with 'number-up=2' the last page is missing.
Calling the pstops-filter manually
/path/to/cups/lib/cups/filter/pstops 1 user title 1 "number-up=2" w1.ps > w1-2up.ps
creates a ps-file, where the last page is displayed incorrectly/incompletely by gv (using AFPL Ghostscript 8.50 (2004-12-10)) and also not printed by our HP LaserJet 4350.
To resolve this, I did the following:
filter/pstops.c (7067 2007-11-09 19:54:09Z mike) contains some code
if (number && !is_first_page(number) && cupsArrayLast(doc->pages)) {
pageinfo = (pstops_page_t *)cupsArrayLast(doc->pages);
start_nup(doc, doc->number_up, 0, doc->bounding_box);
doc_puts(doc, "showpage\n");
end_nup(doc, doc->number_up);
pageinfo->length = cupsFileTell(doc->temp) - pageinfo->offset;
}
which is not executed on the last output page with an odd-page input document, due to the "!is_first_page(number)".
I just removed the !is_first_page(number) test, so the command is now
if (number && cupsArrayLast(doc->pages)) { ... nup-stuff ... }
and everything works fine.
The resulting ps-file is fully printable and can be viewer with gv.
So, why should start/end_nup not be executed on the last output sheet containing only a single page?
More information about the cups-devel
mailing list