I once had to write an app which would fill typographically-printed forms fed into a printer by printing on precisely specified locations. Despite being more of a desktop than a web developer the most straightforward and flexible way I found was generating HTML and print-oriented CSS.