cups icon indicating copy to clipboard operation
cups copied to clipboard

Difference in how the pdftopdf filter is invoked using IPP vs. lp

Open jameshalsall opened this issue 2 years ago • 0 comments

I am observing an unexpected behaviour in the way that the pdftopdf CUPS filter is invoked by CUPS when using an IPP request vs. lp. Of course, these are different protocols and methods of printing, but I would expect to be able to trigger the same behaviour in both.

I have a PDF that is to be printed on A6. The PDF document is slightly larger than A6 and includes cropping lines. When I print via lp with fit-to-page option the printed output correctly contains only the portion of the PDF that fits onto the A6 size media, i.e. the cropping lines and whitespace around it is cropped and not part of the final print out. However, when printing via IPP -> CUPS -> Printer, the cropping lines are included as the whole PDF document is scaled to fit onto the printed A6 page.

NOTE: I have tried with all advertised (from printer attributes) print-scaling options with no change in the output.


CUPS version: 2.3.3 OS: Raspbian GNU/Linux 11 (bullseye)

/etc/cups/printers.conf:

<Printer EPSON_WF_C5210_Series>
PrinterId 1
UUID urn:uuid:e6a69953-c572-321d-5365-a28461a66dac
AuthInfoRequired none
Info EPSON_WF_C5210_Series
MakeModel EPSON WF-C5210 Series, driverless, cups-filters 1.21.6
DeviceURI ipp://EPSONB44453.local:631/ipp/print
State Idle
StateTime 1652877297
ConfigTime 1652715669
Type 36956
Accepting Yes
Shared Yes
JobSheets none none
QuotaPeriod 0
PageLimit 0
KLimit 0
OpPolicy default
ErrorPolicy retry-job
// ...
</Printer>

Printing using lp -d EPSON_WF_C5290_Series -o media=A6 -o fit-to-page -o OutputMode=PhotoMode -o MediaType=LightweightCardstock generated_flyer.pdf invokes the pdftopdf filter as follows:

/usr/lib/cups/filter/pdftopdf 95 "User" "job title" "1" "finishings=3 fit-to-page media=A6 MediaType=LightweightCardstock number-up=1 OutputMode=PhotoMode job-uuid=urn:uuid:2bc0d074-38f1-3982-5c75-e951b4dd6b78 job-originating-host-name=localhost date-time-at-creation= date-time-at-processing= time-at-creation=1653055380 time-at-processing=1653055380 document-name-supplied=generated_flyer.pdf PageSize=A6" generated_flyer.pdf [> out.pdf]

NOTE: We can see the fit-to-page option is being passed onto the pdftopdf filter correctly here, as we would expect. Also, when invoking this manually and inspecting the output, I can see my PDF output is as expected.

If I print via IPP -> CUPS, using following job attributes:

{
  "copies": 1,
  "media-col": {
    "media-source": "auto"
  },
  "fit-to-page": true,
  "print-scaling": "none",
  "media": "iso_a6_105x148mm"
}

then the pdftopdf filter is not invoked with the fit-to-page option...

/usr/lib/cups/filter/pdftopdf 95 "User" "job title" "1" "job-uuid=urn:uuid:8a0cd5c0-0389-3359-78f5-d38b84529487 job-originating-host-name=localhost date-time-at-creation= date-time-at-processing= time-at-creation=1653054418 time-at-processing=1653054418 InputSlot=Auto media=A6 PageSize=A6" generated_flyer.pdf [> out.pdf]

NOTE: When invoking this manually and inspecting the output, I can see my PDF output is not as expected. I believe the fit-to-page option makes this difference. I have also tried including the ipp-attribute-fidelity: true job attribute, with the same result

What I can't find in the CUPS source code is how the fit-to-page option is handed off to the pdftopdf filter.

I would like, if possible, to invoke the pdftopdf filter in the same way using IPP as with lp 🤔

jameshalsall avatar May 23 '22 10:05 jameshalsall