When I built an iPhone app that places photos and PDFs at real-world size, the hardest part wasn't layout; it was agreeing on what "size" means across the pipeline.
The unit that matters
PDF user space is measured in points: 72 per inch. So a Letter page is 612×792 pt, and 1 inch = 72 pt = 25.4 mm. My export check asserts the page box matches the requested size to the millimetre, and I test it with a 25.4 mm calibration square (so 1 in should land at exactly 72 pt in the file).
Where it goes wrong after the file is correct
A correct PDF is necessary, not sufficient. The print dialog can still apply "fit to page", and a driver can still add margins. The app can't see those, so the reliable check is physical: print a known square and measure it. I added exactly that as a free step for the next release (so I won't claim "perfectly accurate").
Practical rules I settled on
- Keep page size as the single source of truth and compute everything from points.
- Never round at the UI layer; round only for display.
- Test at the file level (page box, 25.4 mm), then at the paper level (ruler).
- Treat printers as unreliable narrators.
If you want to try the app (free to build, one-time Pro for printing): Print Size Pro on the App Store (I'm the developer.)