Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PPDs for driverless printing: Make jobs be printed in correct order for face-up/face-down #5345

Closed
wants to merge 3 commits into from

Conversation

tillkamppeter
Copy link

In #5315 and OpenPrinting/cups-filters#47 a user complained about that on printers which stack up their output pages face-up the pages should get printed in reverse order.
I have investigated this and the main problem is that many PPD files are missing the appropriate information about how the paper gets stacked.
In case of driverless printing the answers to the get-printer-attributes request always contains the needed information. Either the names of the output-bins (attributes "output-bin-supported", "output-bin-default" are named "face-up" or "face-down" or there is an array named "printer-output-tray" with the same number of items as "output-bin-supported", describing the properties of each output bin, especially telling about the way the pages get stacked (PWG 5100.13 – IPP: Job and Printer Extensions – Set 3, section 5.6.36).
The patch (which I also have applied to the PPD generator of cups-filters) makes this information available in the generated PPD files for driverless printing. Once, the PPD file gets a "*DefaultOutputOrder: ..." line with either "Normal" or "Reverse" as value, the latter indicating that the pages get stackked face-up in the default tray and therefore the pages need to get printed in reverse order (which pdftopdf of cups-filters takes care of in this case). Second, if the PPD has an "OutputBin" option, I add a "*PageStackOrder ..." line to each choice of the "OutputBin" option telling whether this bin is face-up or face-down. Also this is taken care of by pdftopdf (see "*OutputOrder", p124, and "*PageStackOrder", p125, in Adobe's PPD specs).
This way printers set up with driverless printing of CUPS should print the jobs in the correct order with respect to the fact that they stack their output face-up or face-down.

cups/ppd-cache.c Outdated
/* Find out on which position of the list of output bins the default one is, if there
is no default bin, take the first of this list */
i = 0;
if ((attr = ippFindAttribute(response, "output-bin-supported", IPP_TAG_MIMETYPE)) != NULL)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be IPP_TAG_ZERO to allow for IPP_TAG_KEYWORD or IPP_TAG_NAME values. But not IPP_TAG_MIMETYPE (which is the mimeMediaType syntax...)

cups/ppd-cache.c Outdated
}
}
/* Look up the corresponding entry in the "printer-output-tray" attribute */
if ((attr = ippFindAttribute(response, "printer-output-tray", IPP_TAG_MIMETYPE)) != NULL &&
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

printer-output-tray is of type 1setOf octetString, so you want IPP_TAG_STRING here. And you'll need to use ippGetOctetString, copy it to a C string, and then look for the properties.

@michaelrsweet
Copy link
Collaborator

Till, I appreciate the pull request but the current changes have issues. See my comments...

@tillkamppeter
Copy link
Author

I have fixed the two issues now.

@tudor2k3
Copy link

tudor2k3 commented Jul 2, 2018

Hello,

 Is this also a fix for my Canon IR C1225 not respecting long-edge/short-edge duplex printing? Or do i have to open a different bug?

                 Thank you.

@tillkamppeter
Copy link
Author

@tudor2k3, please open a separate issue, as this one is only for OutputOrder as it does not do more than adding lines concerning the output order to the PPD.

@tillkamppeter
Copy link
Author

Is there still anything to be fixed on my pull request?

@michaelrsweet
Copy link
Collaborator

Till, I haven't had a chance to review this fully, and since I am on a summer break at the moment it won't be happening anytime soon. Don't expect anything to happen until the end of August at the earliest.

@michaelrsweet
Copy link
Collaborator

@tillkamppeter You are still using the non-portable strcasestr function... Since these values are case sensitive, it should just be a matter of changing to strstr.

There are some other potential optimizations I'll look at doing as well...

michaelrsweet added a commit that referenced this pull request Sep 28, 2018
michaelrsweet added a commit that referenced this pull request Sep 28, 2018
@michaelrsweet
Copy link
Collaborator

[master bf86060] Support face-up printers (Issue #5345)

[branch-2.2 fe1fac1] Support face-up printers (Issue #5345)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants