-
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Adding paper source to JobTemplate #5
Comments
PR #4 |
good question ; ) I would assume it is specified using the for quick-and-dirty "raw" support, I would assume something like this will work: let response = try await printer.printJob(
documentFormat: "application/pdf",
jobAttributes: [
.media: .init(.name(.withoutLanguage("some-media"))),
],
data: .bytes(pdf)
) But I am not sure about using name vs keyword. Also, one would probably have to first inspect the |
Thank you @sliemeobn, that already works perfectly to specify the media size. According to the RFC, a keyword is a tighter specification of a nameWithoutLanguage, so as an ad-hoc solution this would work, I will try to integrate it as keywords in a PR, but that will take a bit of time. Probably going to add a few standard paper sizes as constants, too. For the paper source there seems to be a job template attribute, see here: IPP Javascript Lib. However, the RFC seems to have deprecated the use of "media-col". I will need to read up further on that. For now I will try with your documented "some custom keyword" approach. |
Small correction, the
|
As a working example I am using this code and it seems to work: // A6, Bypass Tray
jobAttributes["media-col"] = .init(.collection([
"media-size" : .init(.collection(["x-dimension" : .init(.integer(105 * 100)),
"y-dimension" : .init(.integer(148 * 100))
])),
"media-source" : .init(.keyword("by-pass-tray"))
])) This is printer specific, the |
cool to see, thanks for sharing! but as this code demonstrates: it gets intricate very quickly, with many variants and asterisks (like "what does this printer support") so, I wonder if it is at all worth the trouble trying to wrap this all in a nicely typed API 🤔 |
Absolutely agree, in order to build a sophisticated application, you need to query the printer and determine the options needed/supported. However, in that case you can also use AirPrint, if supported, which will do exactly that for some options already.
I would say that the majority of the options is way too vast to be included, however, a few items are very likely to be used more often, like
Maybe they should be included in a more prominent way and for the rest an example code like mine above could serve as a starting point for a possible implementation. |
I am not an expert in the IPP protocol, but where would be the correct place to specify the paper source / input try to use? I would be happy to provide a PR once I know my way around.
The text was updated successfully, but these errors were encountered: