williamkapke / ipp

Internet Printing Protocol (IPP) for nodejs
412 stars 110 forks source link

Print to a media size not specified #58

Open leandrosilva opened 6 years ago

leandrosilva commented 6 years ago

Hi guys, I'm working with a Lexmark MS911de printer, which provides me these media-supported and media-size-supported options below.

Problem is, I have to print to a 320x600mm, which is not listed below. It is what we call in Brazil "Super A3" and it is very common in visual merchandising at supermarkets and the likes.

I can print a 320x600mm PDF to this printer from Adobe Reader or Google Chrome with no problem using the installed printer driver (as for troubleshooting purpose). But I cannot thru ipp lib. It prints out a "The spec is not clear on how to handle tag 16: media-size=undefined." message, finishes the request with status code "successful-ok-ignored-or-substituted-attributes", and prints and error message to the actual paper.

The request is like:

{
    "operation-attributes-tag": {
        "requesting-user-name": "john",
        "job-name": "sa3h.pdf",
        "document-format": "application/pdf"
    },
    "job-attributes-tag": {
        "media-col": {
            "media-source": "manual",
            "media-size": {
                "x-dimension": "60000",
                "y-dimension": "32000"
            }
        },
        "orientation-requested": "landscape"
    },
    "data": "..."
}

And the response is what follows:

{
    "version": "2.0",
    "statusCode": "successful-ok-ignored-or-substituted-attributes",
    "id": 41886823,
    "operation-attributes-tag": {
        "attributes-charset": "utf-8",
        "attributes-natural-language": "en-us"
    },
    "unsupported-attributes-tag": {},
    "job-attributes-tag": {
        "job-uri": "ipp://10.124.59.191:631/print/job97",
        "job-id": 97,
        "job-state": "pending",
        "job-state-reasons": "none",
        "job-state-message": "none"
    }
}

Any idea on how I can manage to print this 320x600mm PDF thru ipp lib?

Many many thanks, guys.


"media-supported": [
  "na_letter_8.5x11in",
  "jis_b4_257x364mm",
  "jis_b5_182x257mm",
  "na_monarch_3.875x7.5in",
  "na_number-9_3.875x8.875in",
  "na_number-10_4.125x9.5in",
  "na_arch-b_12x18in",
  "na_ledger_11x17in",
  "iso_a3_297x420mm",
  "iso_a4_210x297mm",
  "iso_a5_148x210mm",
  "na_foolscap_8.5x13in",
  "na_invoice_5.5x8.5in",
  "na_oficio_8.5x13.4in",
  "iso_a6_105x148mm",
  "om_universal_320x432mm",
  "iso_sra3_320x450mm",
  "na_legal_8.5x14in",
  "iso_b5_176x250mm",
  "iso_c5_162x229mm",
  "iso_dl_110x220mm",
  "na_executive_7.25x10.5in",
  "custom_min_76.2x123.86mm",
  "custom_max_215.9x1320.8mm"
],

"media-size-supported": [
  {
    "x-dimension": 21590,
    "y-dimension": 27940
  },
  {
    "x-dimension": 25700,
    "y-dimension": 36400
  },
  {
    "x-dimension": 18200,
    "y-dimension": 25700
  },
  {
    "x-dimension": 9842,
    "y-dimension": 19050
  },
  {
    "x-dimension": 9842,
    "y-dimension": 22542
  },
  {
    "x-dimension": 10477,
    "y-dimension": 24130
  },
  {
    "x-dimension": 30480,
    "y-dimension": 45720
  },
  {
    "x-dimension": 27940,
    "y-dimension": 43180
  },
  {
    "x-dimension": 29700,
    "y-dimension": 42000
  },
  {
    "x-dimension": 21000,
    "y-dimension": 29700
  },
  {
    "x-dimension": 14800,
    "y-dimension": 21000
  },
  {
    "x-dimension": 21590,
    "y-dimension": 33020
  },
  {
    "x-dimension": 13970,
    "y-dimension": 21590
  },
  {
    "x-dimension": 21590,
    "y-dimension": 34036
  },
  {
    "x-dimension": 10500,
    "y-dimension": 14800
  },
  {
    "x-dimension": 32000,
    "y-dimension": 43200
  },
  {
    "x-dimension": 32000,
    "y-dimension": 45000
  },
  {
    "x-dimension": 21590,
    "y-dimension": 35560
  },
  {
    "x-dimension": 17600,
    "y-dimension": 25000
  },
  {
    "x-dimension": 16200,
    "y-dimension": 22900
  },
  {
    "x-dimension": 11000,
    "y-dimension": 22000
  },
  {
    "x-dimension": 18415,
    "y-dimension": 26670
  },
  {
    "x-dimension": [
      7620,
      21590
    ],
    "y-dimension": [
      12386,
      132080
    ]
  }
],
michaelrsweet commented 6 years ago

@leandrosilva I'm not sure on the specific error message you're getting from the library, tag 16 decimal is the unsupported attribute value, which gets returned when you send a value to the printer it doesn't support for a particular attribute (in this case, media-size). @williamkapke I'd just represent any out-of-band values as JSON strings ("unsupported", "default", "unknown", etc.) - all out-of-band syntaxes/tags are used as alternate values for attributes.

That said, given the media-supported and media-size-supported values you are getting, the printer is saying the largest custom size media it can print to is 215.9mm (8.5in) wide and 1320.8mm (52in) long, while the largest standard size is 320x432mm. Clearly this printer's IPP implementation isn't returning the true limits for width...

You could try specifying the media-size with an x-dimension of 320 and a y-dimension of 600 (portrait dimensions, which is what IPP wants for sheet-fed media) - if that works for you, great! If not, you'll need to contact Lexmark for some support...

leandrosilva commented 6 years ago

I'm not sure whether it wasn't clear but I'm not saying that there is a problem on the ipp lib. It's instead a call for help to workaround the fact that the printer is hindding a supported media size or something, since I can print the given media size from Adobe Reader or Chrome, which uses the installed printer drive but cannot thru ipp protocol.

I thought maybe youo guys could have any idea on how to work around that with ipp protol. Maybe there is a way to do what looks like the native driver is doing.

You could try specifying the media-size with an x-dimension of 320 and a y-dimension of 600 (portrait dimensions, which is what IPP wants for sheet-fed media) - if that works for you, great! If not, you'll need to contact Lexmark for some support...

Yeah, I have already tried it but with no success. And I got in touch with Lexmark.

Thanks.

michaelrsweet commented 6 years ago

@leandrosilva If you are sending a PDF to the printer you can usually omit the media size from the request and the Right Thing ™ will happen. Something to try at least...

leandrosilva commented 6 years ago

@michaelrsweet Oh yeah, I did it. What ends up happening is that the printer prints it to what seems to be 320x450mm, so it is partially cut.

I've been using this ipp lib with very high success and it is just this new Lexmark printer that has given me a bad time. And I'm afraid Lexmark's technicians can't help me on that.

leandrosilva commented 6 years ago

As a follow up, I was talking to a Lexmark's solution architect and he told me that I can change printer settings by send it (via IPP even) a PJL file with those given commands.

Attached are those commands for that matter.

CustomSize_320x600.pjl.txt