Skip to content

pdftops: do not let pstops reverse pages again after pdftopdf - #122

Merged
tillkamppeter merged 1 commit into
OpenPrinting:masterfrom
xangelix:pstops-no-second-reverse
Nov 22, 2026
Merged

tillkamppeter merged 1 commit into
OpenPrinting:masterfrom
xangelix:pstops-no-second-reverse

Conversation

@xangelix

Copy link
Copy Markdown
Contributor

Fixes #119.

When pdftopdf has run, ppdFilterPDFToPS() removes OutputOrder from the pstops options, but pstops then falls back to the PPD's default output order and reverses a second time. This passes OutputOrder=Normal to pstops in that case, like the existing Collate handling, so only pdftopdf applies the output order.

This bug predates the PDFio transition: the QPDF-based pdftopdf also reversed these jobs from the printer default. The PDFio-based pdftopdf currently skips that default, which OpenPrinting/libcupsfilters#366 restores, so this should be merged together with #366. On its own, jobs without outputorder on face-up PostScript queues would lose their only reversal.

Testing

Real pdftopdf → pdftops chain, 3-page PDF, PostScript PPD with *PageStackOrder FaceUp: Reverse (same results with *DefaultOutputOrder: Reverse):

job option libcupsfilters#366 + libppd master libcupsfilters#366 + this
none 1 2 3 3 2 1
outputorder=normal 3 2 1 1 2 3
outputorder=reverse 1 2 3 3 2 1
sides=two-sided-long-edge 1 2 3 blank blank 3 2 1

With a PPD defaulting to normal order, the output is unchanged. make check passes (14/14).

When the input comes from pdftopdf, ppdFilterPDFToPS() removes
"OutputOrder" from the options for pstops, as pdftopdf has already put
the pages into the right order.  But without "OutputOrder", pstops
falls back to the PPD's default output order (*PageStackOrder of the
default output bin, *DefaultOutputOrder) and reverses the pages a
second time if that is "Reverse".  So on PostScript PPD queues with a
face-up output bin, every job that pdftopdf reverses comes out in the
wrong order: jobs with an explicit "outputorder", and, with the
QPDF-based pdftopdf of libcupsfilters 2.0.x/2.1.x, also jobs without
one, as it reverses them from the printer's default output bin.

Pass "OutputOrder=Normal" to pstops in this case, as is already done
for "Collate", so that the output order is only applied by pdftopdf.
Queues whose PPD defaults to normal order are not affected.

The PDFio-based pdftopdf of libcupsfilters 2.2.x lost that printer
default, so there jobs without "outputorder" currently get their
reversal from pstops only.  This needs OpenPrinting/libcupsfilters#366,
which restores it in pdftopdf.

Fixes OpenPrinting#119.
@tillkamppeter
tillkamppeter merged commit 9341944 into OpenPrinting:master Nov 22, 2026
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pstops re-applies the PPD's default output order after pdftopdf, inverting explicit outputorder on face-up PostScript queues

2 participants