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

what are acceptable strings for --paper-size? #20

Closed
bdantas opened this issue Dec 7, 2023 · 4 comments
Closed

what are acceptable strings for --paper-size? #20

bdantas opened this issue Dec 7, 2023 · 4 comments

Comments

@bdantas
Copy link

bdantas commented Dec 7, 2023

Hi, attah. Thank you very much for pdf2printable, which I use in a shell script to print (by sending PWG to network printer using ipptool). All GNU/Linux computers in my household (mine, wife's, and children's) use this script :) I use pdf2printable rather than mutool because it is so wonderfully minimalistic.

So far I have only needed to use my printer's default paper size (8.5 x 11 inches, aka "letter") and printing "just works" without having to specify paper size to pdf2printable or to ipptool. But I'd like to learn how to print to different paper size (e.g., 8.5 x 14 inches, aka "legal") just in case I need it someday.

I have two questions, please:

  1. Where can I find a list of acceptable strings for pdf2printable --paper-size?
  2. If PWG has been created with pdf2printable --paper-size foo, do I need to specify foo again when using ipptool to send the PWG to printer, or does ipptool automatically determine the paper size based on PWG's dimensions?
@attah
Copy link
Owner

attah commented Dec 7, 2023

Hi!
Thanks for the kind words.

I do believe minimalism just improved even more with that my ippposter application has become usable (though still WIP).
That's basically pdf2printable coupled with my own cURL-based IPP client.

But to answer the question - in short, it is:
"^[0-9a-z_-]+_(([0-9]+[.])?[0-9]+)x(([0-9]+[.])?[0-9]+)(mm|in)$"

I.e. my approximation of what's in https://ftp.pwg.org/pub/pwg/candidates/cs-pwgmsn20-20130328-5101.1.pdf

Rougly: org_name_X[.A]xY[.B]{mm,in}

If you haven't specified a size you get A4; so you should be getting conversion back and forth, which isn't ideal.
I'm honestly a bit surprised the printer accepts the wrong size raster.

ipptool does not read document data at all, but your printer of course does, though it will let the ipp setting override it.
So generally you should be able to omit the paper size to ipptool (including in its file defining the parameters) especially if you have good input (which you will) and/or only one type of media loaded.

ippposter is a bit clumsy to use, in part because it doesn't use files like ipptool.
But it has one neat thing; it will check input against what the printer supports, and tell you what that is:

./ippposter --paper-size foo --format image/pwg-raster ipp://someprinter:631/ipp/print ~/Downloads/1.pdf 
Argument --paper-size <string> (ipp: media) has an invalid value. 
Valid values are: ["iso_a4_210x297mm", "iso_a5_148x210mm", "iso_a6_105x148mm", "jis_b5_182x257mm", "iso_c5_162x229mm", "iso_c6_114x162mm", "na_number-9_3.875x8.875in", "na_number-10_4.125x9.5in", "iso_dl_110x220mm", "na_executive_7.25x10.5in", "na_foolscap_8.5x13in", "na_legal_8.5x14in", "na_letter_8.5x11in", "na_monarch_3.875x7.5in", "custom_min_85.73x139.7mm", "custom_max_8.5x14in"]

@bdantas
Copy link
Author

bdantas commented Dec 8, 2023

Hi, attah. Thank you very much for the detailed response. I think I understand. Only the numbers (with optional decimal part) and units are significant. So something silly such as --paper-size tiny_square_2.5x2.5mm is actually valid, as is the more reasonable --paper-size us_letter_8.5x11in. Is that right?

I'm excited about ippposter. I will definitely try it out. The complexity of printing on linux has always bothered me. Now I'm on a warpath to get the job done as simply as possible!

@attah
Copy link
Owner

attah commented Dec 8, 2023

Valid in the sense that those names will produce the desired dimensions.
But for PWG specifically, the name is also included, so could be good to use a supported and/or standard one.
(I suspect printers care about dimensions, and not names on this level).
When specifying one on IPP though, you need to use a supported one.

US Letter is na_letter_8.5x11in, not us_letter... (see linked PDF)

@bdantas
Copy link
Author

bdantas commented Dec 8, 2023

Got it. Thank you so much for all the pointers. Happy hacking!

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

No branches or pull requests

2 participants