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

Support "print-scaling" option #108

Closed
michaelrsweet opened this issue Apr 16, 2019 · 11 comments · Fixed by #118
Closed

Support "print-scaling" option #108

michaelrsweet opened this issue Apr 16, 2019 · 11 comments · Fixed by #118

Comments

@michaelrsweet
Copy link
Member

The "print-scaling" option is the standard IPP Everywhere option for controlling the scaling of the output; currently defined values are:

  • auto: if the “ipp-attribute-fidelity” attribute is true or the document is larger than the requested media, scale the document using the 'fit' method if the margins are non- zero, otherwise scale using the 'fill' method. If the “ipp-attribute-fidelity” attribute is false or unspecified and the document is smaller than the requested media, scale using the 'none' method.
  • auto-fit: if the “ipp-attribute-fidelity” attribute is true or the document is larger than the requested media, scale the document using the ‘fit’ method. Otherwise, scale using the ‘none’ method.
  • fill: scale the document to fill the requested media size, preserving the aspect ratio of the document data but potentially cropping portions of the document.
  • fit: scale the document to fit the printable area of the requested media size, preserving the aspect ratio of the document data without cropping the document.
  • none: do not scale the document to fit the requested media size. If the document is larger than the requested media, center and clip the resulting output. If the document is smaller than the requested media, center the resulting output.

This attribute is defined in PWG 5100.16: IPP Transaction-Based Printing Extensions.

@tillkamppeter
Copy link
Member

@dheeraj135, could you add this functionality? The actual implementation you have already done with issue #65, issue #63, and pull request #92. What you need to add now is that this functionality is also triggered appropriately by the print-scaling attribute as Mike has shown in the initial posting.

  • print-scaling=fill: This is your "fill-page" asked for in the original posting of issue Add a simple "fill page" scaling option to imagetoraster and pdftopdf (print-scaling=fill) #65, a photo is cropped to the aspect ratio of the output page so that it fills the page exactly.
  • print-scaling=fit: This is the "fitplot" or "fit-to-page" which we had before. The photo is scaled to the fill the imageable area of the destination page the best possible without cropping anything.
  • print-scaling=none: This is the "crop-to-fit" which you had added to solve issue print a4 documents sensibly by default on command-line #63, only centering the input page and cropping what is too large to fit the output page, the best way to print A4 input on a Letter output page or vice-versa keeping the size of the graphical elements on the page.

Please also implement the two auto settings which are simply a selection of one of the three others depending on the “ipp-attribute-fidelity” attribute and the size of the input page compared to the size of the output page.
The implementation should be done in the filters imagetoraster, imagetopdf, and pdftopdf.
Thanks in advance.

@dheeraj135
Copy link
Member

@tillkamppeter Sure, I will work on it.

@dheeraj135
Copy link
Member

dheeraj135 commented May 7, 2019

@tillkamppeter @michaelrsweet, I am not sure how I should compare the size of the document and the page. Suppose the dimension of an image is [100,150] and, that of page is [120,90]. What should be the expected behaviour of auto-fit option?

@tillkamppeter
Copy link
Member

@dheeraj135, first the input page is considered larger than the output frame, as the height of 150 does not fit into the height of 90. Even if we allow rotating to fit the output page the input page is still larger than the output page.
What happens when the "auto-fit" setting is used depends on the state of the “ipp-attribute-fidelity” IPP attribute. If it is set, we have to apply the "fit" method (aka "fit-to-page" or "fitplot"), with “ipp-attribute-fidelity” not set we have to apply the "none" method (the "crop-to-fit" which you had added to fix issue #63).

@aluminaceramix
Copy link

CUPS 2.4.6 in FreeBSD.
print photo image, can't keep aspect ratio in -o print-scaling=fit.
then fit to paper size in vertical and horizontal each scaled.
I want to print shrink image to fit paper size in keep aspect ratio.

@hhartzer
Copy link

hhartzer commented Mar 4, 2024

CUPS 2.4.6 in FreeBSD. print photo image, can't keep aspect ratio in -o print-scaling=fit. then fit to paper size in vertical and horizontal each scaled. I want to print shrink image to fit paper size in keep aspect ratio.

I'm having this issue as well with 2.4.7. Even with -o print-scaling=crop-to-fit.

@aluminaceramix
Copy link

Thank you for reply.

I'm sorry to stupid, I want to shrink image and get white space to print whole image and fit paper size in keep aspect ratio.

@hhartzer
Copy link

hhartzer commented Mar 4, 2024

I'd like to do the same thing. I'm trying to pring a jpeg and it won't scale properly with -fit-to-page.

@aluminaceramix
Copy link

grep -R crop-to-fit in cups-2.4.7 source code, not found.
I test print by -o fit-to-page, then vertical and horizontal each scaled, not keep image aspect ratio.
I want whole image printing with keep image aspect ratio.

@tillkamppeter
Copy link
Member

@aluminaceramix note that these options are not implemented in CUPS itself but in cups-filters. For cups-filters 1.x in the "1.x" branch of the cups-filters repository (this repository) and for cups-filters 2.x in the libcupsfilters repository.

@aluminaceramix
Copy link

Thank you for all reply.

I want whole image printing on single paper with keep aspect ratio.

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

Successfully merging a pull request may close this issue.

5 participants