michaelrsweet / lprint

A Label Printer Application
https://www.msweet.org/lprint
Apache License 2.0
219 stars 29 forks source link

Unwanted scaling on Dymo Duo #77

Closed eriksl closed 1 year ago

eriksl commented 1 year ago

Hi there,

I've created a separate issue, so they don't get mixed.

What I want to do is completely prepare an "image" (of text), where my script takes care of all boundaries of the label. Then the printer should print it as-is, so the image and the preview are the same as what's actually printed. Whenever the script is wrong and pixels are outside the printable area of a certain label type, they should simply be ignored and I should fix the script.

I cannot get this working. Whatever I do, including choosing whatever image scaling "type", the driver of the printer wants to scale the picture itself, always in a way that's completely inappropriate so the result is horrible (large borders left and right, pixels falling off the top and bottom), no matter what resolution I use for the image sent.

Can you please help? With cups I had this working.

michaelrsweet commented 1 year ago

OK, so for starters the DYMO printers have large margins. There is simply no reason why a direct thermal printer can't print to the edges of a label, but that is not the case for their printers. In addition, I see quite a bit of positional variation between labels (i.e. registration errors) so even if they did print to the edges the positioning might not be correct.

It would be good to know what you are trying to print and how - direct PNG image printing from the LPrint command-line will give you the most control.

eriksl commented 1 year ago

I have spent quite a bit of effort to have exactly on tape what I want to have there. So when I still used cups for it, I would already generate PNGs with the exact pixel-for-pixel contents and I got it working at some point. I can't get it to work with lprint because everytime I change the content (!) of the png it gets scaled another way. It seems to search for the first line (horizontal and vertical) that contains one or more black pixels and crop everything outside that area. So whatever dimension png I send, it always get scaled to the same image on paper, causing either ridiculously large, unnecessary borders or parts of characters getting cropped. There is simply no way I can send a png with some defined dimensions and lprint printing it consistently the same way. Cups can do it...

michaelrsweet commented 1 year ago

@eriksl CUPS passes raster data at the device resolution, and if you are printing an image then the CUPS filters are scaling the image to the output page in a very similar way to LPrint/PAPPL. Depending on the filters/application you are using, that PNG file may actually be converted to PDF first, then rasterized at the device resolution, and that device-ready raster data is what is getting printed.

If you want LPrint to treat the PNG file as a full-bleed image, pass "print-scaling=fill" and "media=SIZE". The resolution for the tape printer is 180dpi, while the label printer is 300dpi. Label margins are 3.67mm left/right, 1.5mm top, and 3mm bottom, while tape margins are 5.2mm (!) left/right with relatively long leader/trailer (12+mm). Also, it is important to remember that a 1" tape is really just 24mm (0.94")...