I'm currently building an app for managing a small organization. One of the functions of the app is printing out a bunch of monthly letters to the members. The way it works is I pull data from the DB about the member (name, address, dates, etc...) and then populate a letter template that has placeholder variables for all the details.
After all the letters are populated I need to give the user the option to print the entire block of letters. This is where my problem comes in. I want it so that each letter would print on a single sheet of paper, and the content be centered and aligned in the middle of the page.
I've attempted to make a Print Media stylesheet and inject the content into a div which I then style to fill the page, but this solution doesn't seem to work properly mainly due to layout issues.
Is this something I should be doing with another format? Should I be sending this to Word or PDF for proper handling or is this something that can done with HTML, CSS?
Note: The stack i'm using is bog standard Linux/PHP and I can pretty much install any additional 3rd party library that I might need.
Any ideas?