Comment 110 for bug 382379

Revision history for this message
In , Adrian Johnson (ajohnson-redneon) wrote :

Testing setpagedevice on my printer it seems that if setpagedevice is called after printing one side in duplex mode, the next page will not be on the second side but instead start on a new sheet of paper.

If you want to call setpagedevice on each page to allow pages to be reordered you could emit PS code that checks if the required page size is already selected before calling setpagedevice.

Something like:

  currentpagedevice /PageSize get aload pop
  842 ne exch 595 ne and
  {
      <</PageSize [595 842]>> setpagedevice
  } if

I don't think save/restore is required because poppler reinitializes the gstate parameters used at the start of each page.

I would also be interested to know why pdftops when used as a CUPS filter needs tp emit setpagedevice directly instead of using the "%%IncludeFeature" style comments as described at http://www.cups.org/documentation.php/doc-1.4/spec-postscript.html and letting CUPS insert the page select PS code based on the PPD file.