PDF MediaBox vs Fit to Page: Why Row 10 Leaves the Sticker
A 30-up Avery sheet is a simple grid until a print dialog decides to be helpful. The top row looks fine. The middle looks suspicious. By row 10, the barcode has climbed across the perforation. It feels like a template b
A 30-up Avery sheet is a simple grid until a print dialog decides to be helpful.
The top row looks fine. The middle looks suspicious. By row 10, the barcode has climbed across the perforation. It feels like a template bug, but the usual culprit is a printer scaling mode that shrank the entire page by about 3.5%.
Cumulative error is the whole story
A US Letter page is 11 inches tall. A 30-up sheet has ten 1-inch rows plus half-inch margins at the top and bottom. If the viewer chooses 'Fit to Printable Area' and scales the page to 96.5%, the first row moves only a fraction of a millimetre. The tenth row is 254 mm down the sheet, so the same percentage has become an 8.9 mm shift.
This is why judging only row 1 is such a reliable way to waste a pack of labels.
MediaBox is physical, CSS is hopeful
A PDF page has a MediaBox in PostScript points: 72 points per inch. US Letter is 612 × 792 points. A 2 × 1 in thermal label is 144 × 72 points. When a generator writes those exact page dimensions, the print dialog has something physical to honor.
Our Avery 5160 template builds the sheet from exact geometry rather than letting a flex grid round cells independently. The 2 × 1 thermal roll generator sets the page itself to one label, so each advance lands on one die-cut.
That still does not stop a human from selecting 'Fit'. Nothing can. The fix is to make the scaling mistake measurable before expensive stock goes into the printer.
Put a ruler in the document
The alignment-test PDF includes a 100 mm scale bar. Print it on plain paper at 100%, then measure it. If the bar reads 96 mm, the dialog is still scaling. Hold the page behind a blank Avery sheet against a window and every red box should sit inside its sticker.
The guide to printing Avery 5160 without drift breaks down the symptoms: uniform offset usually means tray margins, left-to-right drift often means A4 was selected instead of US Letter, and progressive vertical shrink usually means fit-to-page.
Do not start by editing the template. Start by proving whether the paper and the PDF agree about how big an inch is.
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.