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

page-ranges #72

Open
yusef-ho opened this issue Jan 6, 2019 · 11 comments
Open

page-ranges #72

yusef-ho opened this issue Jan 6, 2019 · 11 comments

Comments

@yusef-ho
Copy link

yusef-ho commented Jan 6, 2019

Hello
what is the format of page-ranges??
currently my message is

let printMsg = {
    'operation-attributes-tag': {
        'requesting-user-name': 'Hello',
        'job-name': 'iid-',
        "document-format": "application/pdf"
    },
    "job-attributes-tag": {
        "print-color-mode": "monochrome",
        "sides": "one-sided",
        "copies": 1,
        "orientation-requested": "landscape",
        "page-ranges": "1-2",
        "number-up": 2
    },
    data: file
};

without specifying page-ranges, everything goes well. but when specify page-ranges
it shows

{ version: '2.0',
  statusCode: 'client-error-bad-request',
  id: 55936282,
  'operation-attributes-tag':
   { 'attributes-charset': 'utf-8',
     'attributes-natural-language': 'en-us',
     'status-message': 'Bad page-ranges values 1-0.' } }

Thanks

@caomanhquang
Copy link

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?

@caomanhquang
Copy link

@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.

@michaelrsweet
Copy link

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... :/

@caomanhquang
Copy link

caomanhquang commented Jul 11, 2019

@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?

@michaelrsweet
Copy link

Currently there is not a way to determine the maximum number of values a printer supports... :/

@caomanhquang
Copy link

@michaelrsweet
Thank you.

@fpauser
Copy link

fpauser commented Jan 30, 2020

So the only solid solution is not to use page-ranges?

@manuelnucci
Copy link

Any update on this? @caomanhquang, what did you do in the end?

@caomanhquang
Copy link

@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 😅

@manuelnucci
Copy link

Great, I'll try to do the same for the moment...

@Rebnerd
Copy link

Rebnerd commented Dec 2, 2021

rangeOfInteger
how exactly did you fixed it?
can you post the code ?

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

6 participants