Florent Rougon <f.rou...@free.fr> wrote: > - printer matrix alignment if printer resolution is low (more > difficult; maybe try with some very small horizontal and veritical > shifts to see if it helps...).
Thinking about it more, this is probably hopeless unless printer resolution is *extremely* low. Typical printer dots are so small that you can't realistically expect paper placement to have good enough precision to align both grids (say, 1/4 of the printer dot size). This is, I believe, what Jeremy meant when he wrote earlier in this thread: > Getting back to pixel registration, the latex CUPS route is very unlikely to > work well. However a custom application that generates a pixel perfect bitmap > that is printed at 100% scale through cups should work. I agree with that if printer resolution is so low that the QR code and printer dot grids have to be aligned. Even with perfect size in the PDF, there is very little hope that paper will be every time correctly aligned in the vertical and horizontal directions with the matrix of dots managed by the printer—a dot at 300 dpi being approximately 0.08 mm. The only realistic hopes are: - high enough resolution that grid alignment doesn't really matter (is 300 dpi enough? Maybe.); - direct control over the printer bitmap (what Jeremy mentioned). For the sake of completeness, the following LaTeX document (an inline attachment) draws a QR code whose modules are correctly placed for some “ideal” 300 dpi printer. This assumes that printer dots perfectly start at a dot-size multiple from the top left corner of the physical page, which probably can't be obtained in practice. So, this is mainly to show how accurate placement and computations can be done (\fpeval is provided by xfp; it is very accurate and expandable).
\documentclass{article} \usepackage[papersize={50mm,35mm},margin=0cm]{geometry} \usepackage{xfp} \usepackage{qrcode} \pagestyle{empty} \newlength{\modulesize} \setlength{\modulesize}{\fpeval{6/300}in}% assume 300 dpi, set 6 dots/module \begin{document} \noindent \hspace{10\modulesize}% horizontal offset from paper edge: 10 modules \raisebox{\dimexpr \topskip - \height - 10\modulesize}{% ditto in vert. direction \qrcode[height=25\modulesize, version=2]{Hey Debian-user!}}% % The modules will have the expected size only if the QR code is effectively % doable at version=2 (check the LaTeX terminal output). Indeed, version=2 % means 25×25 modules. \end{document}
Regards -- Florent