qzind / qz-print

Archive for legacy qz-print versions (1.8, 1.9). See https://github.com/qzind/tray for modern versions.
Other
141 stars 101 forks source link

2.25in x 1.25in Dymo Label Support #177

Closed tresf closed 8 years ago

tresf commented 8 years ago

The label size 2.25in x 1.25in seems to have scaling/margin issues with the Dymo LabelWriter driver.

var config = qz.configs.create("DYMO LabelWriter 450 Turbo", {size: {width: 2.25, height: 1.25}, units: 'in', density: 0, interpolation: "nearest-neighbor" });

image


Debug logs:

[DEBUG] 2016-02-22 17:36:54,492 @ qz.ws.PrintSocketClient:166
    Message: {"call":"print","promise":{},"params":{"printer":{"name":"DYMO LabelWriter 450 Turbo"},"options":{"colorType":"color","copies":1,"jobName":null,"density":0,"duplex":false,"interpolation":"nearest-neighbor","margins":0,"orientation":null,"paperThickness":null,"printerTray":null,"rotation":0,"scaleContent":true,"size":{"width":2.25,"height":1.25},"units":"in","altPrinting":false,"encoding":null,"endOfDoc":null,"perSpool":1},"data":[{"type":"image","data":"http://localhost:63342/qz-print/assets/img/image_sample.png"}]},"timestamp":1456180614481,"uid":"mrzw05"}
[WARN] 2016-02-22 17:36:54,496 @ qz.ws.PrintSocketClient:204
    Bad signature on request
[INFO] 2016-02-22 17:36:55,450 @ qz.common.TrayManager:403
    Allowed localhost to print to DYMO LabelWriter 450 Turbo
[DEBUG] 2016-02-22 17:36:55,516 @ qz.printer.PrintServiceMatcher:42
    Searching for PrintService matching DYMO LabelWriter 450 Turbo
[DEBUG] 2016-02-22 17:36:55,560 @ qz.printer.PrintServiceMatcher:27
    Found 12 printers
[DEBUG] 2016-02-22 17:36:55,560 @ qz.printer.PrintServiceMatcher:72
    Found match: DYMO LabelWriter 450 Turbo
[DEBUG] 2016-02-22 17:36:55,697 @ qz.ws.PrintSocketClient:441
    Using qz.printer.action.PrintImage to print
[DEBUG] 2016-02-22 17:36:55,738 @ qz.printer.action.PrintImage:89
    Parsed 1 images for printing
[TRACE] 2016-02-22 17:36:55,933 @ qz.printer.action.PrintPixel:59
    DPI: 0.0    CNV: 72.0
[TRACE] 2016-02-22 17:36:55,934 @ qz.printer.action.PrintPixel:88
    Drawable area: 0.0,0.0:162.0,90.0
[TRACE] 2016-02-22 17:36:55,935 @ qz.printer.action.PrintPixel:96
    [color, (0.0,0.0)->(57.15,31.75)mm]
[INFO] 2016-02-22 17:36:56,202 @ qz.printer.action.PrintPixel:103
    Starting printing (1 copies)
[TRACE] 2016-02-22 17:36:58,660 @ qz.printer.action.PrintImage:125
    Requested page 0 for printing
[TRACE] 2016-02-22 17:36:58,661 @ qz.printer.action.PrintImage:143
    {Global antialiasing enable key=Antialiased rendering mode, Fractional metrics enable key=Integer text metrics mode, Stroke normalization control key=Pure stroke conversion for accurate paths, Text-specific LCD contrast key=140, Alpha blending interpolation method key=Highest quality alpha blending methods, Global rendering quality key=Highest quality rendering methods, Color rendering quality key=Highest quality color rendering mode, Text-specific antialiasing enable key=Default antialiasing text mode, Image interpolation method key=Nearest Neighbor image interpolation mode}
[DEBUG] 2016-02-22 17:36:58,661 @ qz.printer.action.PrintImage:167
    Paper area: 2,4:156,81
[TRACE] 2016-02-22 17:36:58,661 @ qz.printer.action.PrintImage:168
    Image size: 144,81
[TRACE] 2016-02-22 17:36:58,683 @ qz.printer.action.PrintImage:125
    Requested page 0 for printing
[TRACE] 2016-02-22 17:36:58,684 @ qz.printer.action.PrintImage:143
    {Global antialiasing enable key=Antialiased rendering mode, Fractional metrics enable key=Integer text metrics mode, Stroke normalization control key=Pure stroke conversion for accurate paths, Text-specific LCD contrast key=140, Alpha blending interpolation method key=Highest quality alpha blending methods, Global rendering quality key=Highest quality rendering methods, Color rendering quality key=Highest quality color rendering mode, Text-specific antialiasing enable key=Default antialiasing text mode, Image interpolation method key=Nearest Neighbor image interpolation mode}
[DEBUG] 2016-02-22 17:36:58,684 @ qz.printer.action.PrintImage:167
    Paper area: 2,4:156,81
[TRACE] 2016-02-22 17:36:58,684 @ qz.printer.action.PrintImage:168
    Image size: 144,81
[TRACE] 2016-02-22 17:36:58,687 @ qz.printer.action.PrintImage:125
    Requested page 0 for printing
[TRACE] 2016-02-22 17:36:58,687 @ qz.printer.action.PrintImage:143
    {Global antialiasing enable key=Antialiased rendering mode, Fractional metrics enable key=Integer text metrics mode, Stroke normalization control key=Pure stroke conversion for accurate paths, Text-specific LCD contrast key=140, Alpha blending interpolation method key=Highest quality alpha blending methods, Global rendering quality key=Highest quality rendering methods, Color rendering quality key=Highest quality color rendering mode, Text-specific antialiasing enable key=Default antialiasing text mode, Image interpolation method key=Nearest Neighbor image interpolation mode}
[DEBUG] 2016-02-22 17:36:58,688 @ qz.printer.action.PrintImage:167
    Paper area: 2,4:156,81
[TRACE] 2016-02-22 17:36:58,688 @ qz.printer.action.PrintImage:168
    Image size: 144,81
[INFO] 2016-02-22 17:36:58,701 @ qz.ws.PrintSocketClient:445
    Printing complete

Forcing 11354 paper size:

[DEBUG] 2016-02-22 17:39:27,601 @ qz.printer.PrintServiceMatcher:72
    Found match: DYMO LabelWriter 450 Turbo
[DEBUG] 2016-02-22 17:39:27,605 @ qz.ws.PrintSocketClient:441
    Using qz.printer.action.PrintImage to print
[DEBUG] 2016-02-22 17:39:27,642 @ qz.printer.action.PrintImage:89
    Parsed 1 images for printing
[TRACE] 2016-02-22 17:39:27,680 @ qz.printer.action.PrintPixel:59
    DPI: 0.0    CNV: 72.0
[TRACE] 2016-02-22 17:39:27,681 @ qz.printer.action.PrintPixel:88
    Drawable area: 0.0,0.0:162.0,90.0
[TRACE] 2016-02-22 17:39:27,681 @ qz.printer.action.PrintPixel:96
    [color, (0.0,0.0)->(57.15,31.75)mm]
[INFO] 2016-02-22 17:39:27,682 @ qz.printer.action.PrintPixel:103
    Starting printing (1 copies)
[TRACE] 2016-02-22 17:39:27,748 @ qz.printer.action.PrintImage:125
    Requested page 0 for printing
[TRACE] 2016-02-22 17:39:27,748 @ qz.printer.action.PrintImage:143
    {Global antialiasing enable key=Antialiased rendering mode, Fractional metrics enable key=Integer text metrics mode, Stroke normalization control key=Pure stroke conversion for accurate paths, Text-specific LCD contrast key=140, Alpha blending interpolation method key=Highest quality alpha blending methods, Global rendering quality key=Highest quality rendering methods, Color rendering quality key=Highest quality color rendering mode, Text-specific antialiasing enable key=Default antialiasing text mode, Image interpolation method key=Nearest Neighbor image interpolation mode}
[DEBUG] 2016-02-22 17:39:27,749 @ qz.printer.action.PrintImage:167
    Paper area: 2,4:156,81
[TRACE] 2016-02-22 17:39:27,749 @ qz.printer.action.PrintImage:168
    Image size: 144,81
[TRACE] 2016-02-22 17:39:27,761 @ qz.printer.action.PrintImage:125
    Requested page 0 for printing
[TRACE] 2016-02-22 17:39:27,762 @ qz.printer.action.PrintImage:143
    {Global antialiasing enable key=Antialiased rendering mode, Fractional metrics enable key=Integer text metrics mode, Stroke normalization control key=Pure stroke conversion for accurate paths, Text-specific LCD contrast key=140, Alpha blending interpolation method key=Highest quality alpha blending methods, Global rendering quality key=Highest quality rendering methods, Color rendering quality key=Highest quality color rendering mode, Text-specific antialiasing enable key=Default antialiasing text mode, Image interpolation method key=Nearest Neighbor image interpolation mode}
[DEBUG] 2016-02-22 17:39:27,762 @ qz.printer.action.PrintImage:167
    Paper area: 2,4:156,81
[TRACE] 2016-02-22 17:39:27,762 @ qz.printer.action.PrintImage:168
    Image size: 144,81
[TRACE] 2016-02-22 17:39:27,764 @ qz.printer.action.PrintImage:125
    Requested page 0 for printing
[TRACE] 2016-02-22 17:39:27,765 @ qz.printer.action.PrintImage:143
    {Global antialiasing enable key=Antialiased rendering mode, Fractional metrics enable key=Integer text metrics mode, Stroke normalization control key=Pure stroke conversion for accurate paths, Text-specific LCD contrast key=140, Alpha blending interpolation method key=Highest quality alpha blending methods, Global rendering quality key=Highest quality rendering methods, Color rendering quality key=Highest quality color rendering mode, Text-specific antialiasing enable key=Default antialiasing text mode, Image interpolation method key=Nearest Neighbor image interpolation mode}
[DEBUG] 2016-02-22 17:39:27,766 @ qz.printer.action.PrintImage:167
    Paper area: 2,4:156,81
[TRACE] 2016-02-22 17:39:27,766 @ qz.printer.action.PrintImage:168
    Image size: 144,81
[INFO] 2016-02-22 17:39:27,777 @ qz.ws.PrintSocketClient:445
    Printing complete
``
tresf commented 8 years ago

Got it...

config = qz.configs.create("DYMO LabelWriter 450 Turbo", 
   {
      size: {width: 2.25, height: 1.25}, units: 'in', 
      colorType: 'grayscale', interpolation: "nearest-neighbor" 
   }
);
  1. Very important: colorType: 'grayscale' seems to be mandatory for this printer or else printout is pixelated, light and improperly dithered.
  2. The height of the picture (originally 215px by 121px) needed to be shrunk by 2 pixels (now 215px by 119px) to make it closer to 2.25in x 1.25in proportions (thanks @bberenz)
  3. The interpolation needs to be configured as nearest-neighbor to prevent pixel smoothing on the barcode. Pixel smoothing could render the barcode un-scannable after it's been stretched to 300dpi.
  4. If the image looks grainy or pixelated, it's due to the driver's default color behavior, use grayscale. In my tests, printing through Windows must do this automatically when it detects a pure black+white image palette, which is what was producing inconstant results between Windows and QZ Tray.

Worth noting.... When the printer was paused, the selected-page-size (Document Properties, Paper/Quality, Advanced) could be observed as Form 30334 - 2 1/4 x 1 1/4 unless explicitly set. In testing this form is nearly identical to 13354 - Multipurpose except the additional margins were distributed slightly differently. In both cases, the print driver was correctly selecting the correct page size, but seems to prefer 30334 by default unless 13354 is explicitly set in the printer properties.

tresf commented 8 years ago

Hmm... I still think there is some room for improvement here...

I took a ruler to the output of some tests and tweaked the image size and was able to help the right margin however the top margin still seems to be wrong. Here's a comparison against a plain black HTML page printed with Google Chrome.

image

akberenz commented 8 years ago

I'm actually getting the same margins qz vs chrome:

2016 02 29_10 52 55

Can you verify the default page type set on your label printer? As it does affect where the printer thinks the top-left 0,0 is located

tresf commented 8 years ago

@bberenz thanks for testing. Interesting that we get different output.

I tried various default page types and yielded nearly identical results (In recent testing I was no longer to reproduce our findings that the margins were drastically changed between page types). Which page type yielded the results in your testing?

I'd like to use the exact same sample and configuration as you're using and go from there. Can you email me the image and the sample.html?