Open gmapp2 opened 2 years ago
Could you try
/usr/lib/cups/filter/pdftopdf 1 me '' 1 'print-scaling=none' <./input.pdf > ./output.pdf
The option print-scaling=none
should make pdftopdf
keeping the input page sizes.
Hey there! I might have run into the same issue...
I created a pdf-file with a custom page-size of 100x150pt.
If I run pdftopdf without any options on ubuntu focal with cups filters version 1.27.4-1, I get the following:
root@d307b8b4f5cc:/worker# /usr/lib/cups/filter/pdftopdf 1 me '' 1 '' /muster/test_100x150.pdf > /out/out.pdf && pdfinfo /out/out.pdf
DEBUG: pdftopdf: No PPD file specified, could not determine whether to log pages or not, so turned off page logging.
DEBUG: PDF interactive form and annotation flattening done via QPDF
[...]
Page size: 149.44 x 99.626 pts
Page rot: 270
[...]
If I run it with print-scaling=none
on ubuntu focal with version 1.27.4-1, I get the following:
root@d307b8b4f5cc:/worker# /usr/lib/cups/filter/pdftopdf 1 me '' 1 'print-scaling=none' /muster/test_100x150.pdf > /out/out.pdf && pdfinfo /out/out.pdf
DEBUG: pdftopdf: No PPD file specified, could not determine whether to log pages or not, so turned off page logging.
DEBUG: PDF interactive form and annotation flattening done via QPDF
[DEBUG]: Cropping input pdf and Enabling fitplot.
After Cropping: 149.440002 99.625999 149.440002 99.625999
[...]
Page size: 792 x 612 pts (letter)
Page rot: 270
If I run it without any options on ubuntu jammy with version 1.28.15-0ubuntu1, I get the following:
root@8eea95cb37c8:/worker# /usr/lib/cups/filter/pdftopdf 1 me '' 1 '' /muster/test_100x150.pdf > /out/out.pdf && pdfinfo /out/out.pdf
DEBUG: pdftopdf: No PPD file specified, could not determine whether to log pages or not, so turned off page logging.
DEBUG: PDF interactive form and annotation flattening done via QPDF
DEBUG: pdftopdf: "print-scaling" IPP attribute: auto
DEBUG: pdftopdf: Print scaling mode: Do not scale, center, crop if needed
After Cropping: 149.440002 99.625999 792.000000 612.000000
[...]
Page size: 612 x 792 pts (letter)
Page rot: 0
[...]
If I run it with print-scaling=none
on ubuntu jammy with version 1.28.15-0ubuntu1, I get the following:
root@8eea95cb37c8:/worker# /usr/lib/cups/filter/pdftopdf 1 me '' 1 'print-scaling=none' /muster/test_100x150.pdf > /out/out.pdf && pdfinfo /out/out.pdf
DEBUG: pdftopdf: No PPD file specified, could not determine whether to log pages or not, so turned off page logging.
DEBUG: PDF interactive form and annotation flattening done via QPDF
DEBUG: pdftopdf: "print-scaling" IPP attribute: none
DEBUG: pdftopdf: Print scaling mode: Do not scale, center, crop if needed
After Cropping: 149.440002 99.625999 792.000000 612.000000
[...]
Page size: 612 x 792 pts (letter)
Page rot: 0
[...]
Version 1.28.17-1 on Arch Linux behaves in the same way as 1.28.15-0ubuntu1.
Your comment implies, that all versions should create a file with Page size: 149.44 x 99.626 pts
, at least if you provide print-scaling=none
doesn't it?
With pdftopdf
of cups-filters 2.x it works correctly when using print-scaling=none
, for 1.x it is not working, Marking this as a bug in 1.x ...
Now pdftopdf
of cups-filters 2.x (libcupsfilters 2.x) works also correctly when not using print-scaling
at all, as in your case of not supplying printer attributes (PPD file) and not supplying a page size for the job (PageSize
or media
option in the 5th command line argument) we overtake the input page size now instead of defaulting to US Letter, we only default to US Letter if all pages of the job have to be the same size, for N-up and/or booklet printing.
You can also use landscape
, nolandscape
, orientation-requested
, and position
now, to suppress auto-rotation and manually determine how the input pages should be placed on the output page.
@tillkamppeter hi, I was investigating this since we are also using the 1.x branch.
I think that the reason print-scaling=none
isn't working in 1.x is that the new branch has introduced pagesize_requested
to the param
struct, and this field is set when print-scaling=none
is passed, changing the logic inside ProcessPDFToPDF()
, but this logic is missing in the 1.x version.
I've artificially reproduced this in 1.x and get the expected results, but trying to do something suitable for upstream has proven not so trivial, since the new branch is calling cfGetPageDimensions()
to set pagesize_requested
when setting the param
struct, and I'm not confident about how to do the same in the 1.x version, but I could do it if you give me some pointers :)
I apologies if this is not the right place to report my problem.
I have a script that uses the cups filter to automatically convert pdf files. The command in question is
/usr/lib/cups/filter/pdftopdf 1 me '' 1 '' <./input.pdf > ./output.pdf
If I run it on my PC I get as output an A4 or A3 document, depending on the input. On Ubuntu server (updated) the input document format is ignored and I always get a US letter format.
The command /usr/lib/cups/filter/pdftopdf 1 me '' 1 'PageSize=A3' <./input.pdf > ./output.pdf works. But I would like to avoid having to specify A4 or A3 format each time. Is there any way to reproduce the old behavior with the new version?
Thanks