[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: printing QR-codes on labels with 300dpi label printers with LaTeX



On 10/03/2024 10:51, jeremy ardley wrote:

I have far less problems with the QR code (in my case data_matrix code) than with the barcode. The pixel elements of the QR code are much larger than the lines in a barcode so there is much less chance for pixel ambiguity.

From your earlier message I count approximately 1000px for 5in (125 mm) barcode. If it is 1:1 to ~200dpi then it is incompatible with 300dpi printers, so it may be a reason why your proposal to the post office was rejected. If it is 500 black or white lines and each one occupies 2 printer dots then 300dpi image of the same size has 3 dots per line. (Sorry, I am unsure concerning "module" term.) You should be able to rasterize PDF files to 600dpi (2x factor) and downsample them by 1/3 keeping lines sharp.

Certainly this simple trick would fail if QR in the same file requires 3/4 scaling.

from pdf2image import convert_from_path

The pdfimage(1) tool may extract images in their original format, perhaps there is a similar python module.

         detected_codes = pyzbar.decode(img)

Each barcode and QR code may be resampled individually without recognizing it. If position of each image on the page is known, resampled images may be put back to correct places in the document rasterized to your printer resolution.

P.S. Post office guys may believe that labels created using laser printers are more resistant to wearing during processing and delivery, so 300dpi resolution may be intentional to discourage usage of thermal printers.


Reply to: