cups-filters icon indicating copy to clipboard operation
cups-filters copied to clipboard

Unexpected rotation of the content inside a pdf

Open haba-beton opened this issue 2 years ago • 10 comments

Describe the bug When printing a A4 Portrait Page ,the PDF orientation is altered by CUPS or cups-filter, resulting in the PDF being printed in landscape orientation.

To Reproduce Steps to reproduce the behavior:

  1. Download the following pdf: sample.pdf
  2. Print the pdf: /usr/bin/lp -d PRINTER -n 1 -o media=A4 -o print-color-mode=monochrome -o Duplex=None -o collate=true -o cupsFinishingTemplate=none sample.pdf or
  3. Execute the following command: /usr/sbin/cupsfilter -p /etc/cups/ppd/PRINTER.ppd -m application/vnd.cups-pdf sample.pdf > out.pdf
    • Following file is received from the above command: out.pdf

Expected behavior The expected behavior is for the PDF to be printed in portrait orientation as it is shown in the sample pdf. Instead, it is printed in landscape orientation, and the printout is not as expected.

System Information:

  • OS and its version: Ubuntu 22.04.3 LTS
  • CUPS version 2.4.1

Additional context This issue occurs regardless of the printer used. No error messages are received; the only issue is with the output being different than expected.

haba-beton avatar Nov 10 '23 13:11 haba-beton

Moving to cups-filters project...

michaelrsweet avatar Nov 10 '23 14:11 michaelrsweet

@haba-beton I tried reporducing the behaviour and it does happen for this pdf given by you, but when i tried using other any other pdf which I have, it is printing in portrait mode. Could you please tell whether the sample PDF file is generated in a specific way or using certain software?

uddhavphatak avatar Mar 13 '24 04:03 uddhavphatak

@uddhavphatak Thanks for checking. The provided PDF was made in Word, laid out in landscape, and printed via Adobe Acrobat in portrait format, without using "Print as picture". If we check the option "Print as Picture" then it comes out as expected.

haba-beton avatar Mar 18 '24 09:03 haba-beton

@haba-beton There is also a way to print the SAMPLE.pdf in portrait mode:

/usr/sbin/cupsfilter -p /etc/cups/ppd/PRINTER.ppd -m application/vnd.cups-pdf -o media=A4 -o orientation-requested=3 sample.pdf > out.pdf

uddhavphatak avatar Mar 18 '24 10:03 uddhavphatak

@uddhavphatak Cups does that automatically.

haba-beton avatar Mar 18 '24 11:03 haba-beton

Even if we use the above parameter provided by you "orientation-requested=3", it still comes out wrong. out5.pdf

haba-beton avatar Mar 18 '24 12:03 haba-beton

But utilizing the "-o nopdfAutoRotate" option does produce the expected output: out6.pdf. However, this isn't a viable solution for all scenarios, as there are instances where automatic rotation is necessary.

haba-beton avatar Mar 18 '24 12:03 haba-beton

Could you please tell what version of CUPS and system you are using. I am using Ubuntu 23.04

Also I double checked "-o orientation-requested=3" and the output is coming in portrait mode only. I think it is working because the 3 means the request for landscape. Modes 1 and 2 are giving output as given in the issue. But the mode=4 also means landscape, but that too is giving output as stated in the issue.

uddhavphatak avatar Mar 18 '24 13:03 uddhavphatak

And yes, you are correct, configuration-based commands are not viable. We might have to solve it by debugging the code.

uddhavphatak avatar Mar 18 '24 13:03 uddhavphatak

Could you please tell what version of CUPS and system you are using. I am using Ubuntu 23.04

Also I double checked "-o orientation-requested=3" and the output is coming in portrait mode only. I think it is working because the 3 means the request for landscape. Modes 1 and 2 are giving output as given in the issue. But the mode=4 also means landscape, but that too is giving output as stated in the issue.

We are using the following versions: OS and its version: Ubuntu 22.04.3 LTS CUPS version 2.4.1

Sadly thats not the case in our system.

haba-beton avatar Mar 18 '24 14:03 haba-beton