Open yusef-ho opened 5 years ago
I have the same problem, I tried to used rangeOfInteger
as defined in lib/attributes.js
but there's no luck. Result is success without any error, but printer out put all pages.
@williamkapke could you help me, does library support page-ranges
now?
@williamkapke
I've fixed lib/serializer.js
a bit, now I can set page-ranges
as a rangeOfInteger
(e.g 1..3 or 2..4). But I still cannot set a 1setOf rangeOfInteger
. When I try, it seems that only last range takes effect.
Do you know how to encode 1setOf rangeOfInteger
correctly?
I read rfc2910
to see how to encode 1setOf X
but it only say this: Encoding according to the rules for an attribute with more than 1 value
. No more detail.
First, stop using RFC 2910. We published an update (RFC 8010 for 2910, and 8011 for 2911) over two years ago...
Second, all 1setOf values are encoded the same - the first value is encoded with the attribute name and the subsequent values are encoded with an empty (0-length) name, e.g. page-ranges=1-3,5-9,11-15 would be encoded as:
0x33 (rangeOfInteger)
0x00 0x0b (name-length)
"page-ranges" (name)
0x00 0x08 (value-length)
0x00 0x00 0x00 0x01 0x00 0x00 0x00 0x03 (1..3)
0x33 (rangeOfInteger)
0x00 0x00 (name-length)
0x00 0x08 (value-length)
0x00 0x00 0x00 0x05 0x00 0x00 0x00 0x09 (5..9)
0x33 (rangeOfInteger)
0x00 0x00 (name-length)
0x00 0x08 (value-length)
0x00 0x00 0x00 0x0b 0x00 0x00 0x00 0x0f (11..15)
That said, keep in mind that many printers don't support page-ranges, and if they do they may only support a single range... :/
@michaelrsweet Thanks a lot for replying me. I understood.
My printers are HP LaserJet Pro MFP M225dw
and NEC Color MultiWriter 5800C
.
When I check by Get-Printer-Attributes
they return "page-ranges-supported": true
I also tried some other ipp implementations, e.g ipptool (from CUPS), jipp (from HPInc) and pass a set of multiple ranges, it seems that only the last range in the set is used by the printer.
I'm wondering is there any way to check whether printer support multiple range or single range, do you have any advice?
Currently there is not a way to determine the maximum number of values a printer supports... :/
@michaelrsweet Thank you.
So the only solid solution is not to use page-ranges?
Any update on this? @caomanhquang, what did you do in the end?
@manuelnucci Because this is the problem from printer, I could not do anything to solve completely. Luckily, I control pdf content so I re-generated a new pdf file from the pages which user chose 😅
Great, I'll try to do the same for the moment...
rangeOfInteger how exactly did you fixed it? can you post the code ?
Hello what is the format of page-ranges?? currently my message is
without specifying page-ranges, everything goes well. but when specify page-ranges it shows
Thanks