So I'm coding a system for work that lets us enter some business names/addresses into the database and allows envelopes to be printed for each business that was entered. I've mostly completed this. The database part works fine, entries can be added/edited/deleted and whatever, but the printing part is baffling me. I figured the best way to print the envelopes was to make a PDF with one page per envelope, then have the user download that and print it onto envelopes, so I wrote the code. My PDF is created and sent to the user beautifully. It looks 100% perfect on screen...then I try to print it. It seems like every printer prints it differently, and it doesn't look right on any of them. In the printer dialog I set the page size to a #10 envelope, but when the envelope finishes printing it's off center causing the top and bottom of the envelope to be lopped off. Curiously, the horizontal axis seems to be printing correctly (at least judging by the fact that the destination address is centered as it should be).
The envelope in question is a standard #10 envelope, no window. I used 684 x 315 as my page dimensions (found those numbers online somewhere). Apparently, this isn't good enough. As I researched the problem, I found out that converting pixels to inches on print media is a colossal pita at best. Apparently I need to take the printer's DPI setting into effect to get my correct page dimensions? I don't even know how to do that, or if it's even possible from PHP.
What should I do to make these print correctly? Am I even on the right track?