PHP App printing to template

I started by asking this in the CSS forum but I think I may be going about this the wrong way.
I have developed an app that manages students courses.

Part of this app is that once the student completes the course, the admin has to print a certification card for the student.
The certification card is on a preprinted sheet that gets fed through the printer.
Has space for student name, instructor name, card valid date, training location, etc.

I have created a section of the PHP site called “Card printing” and in this section the admin selects the students that he wants to print cards for and clicks “print”
form there I am lost on what to do.
It needs to create a card for each student, export it to PDF or .doc file and then align perfectly with the preprinted cards.
What is the recommended way of doing this? If i am going to PDF do I still need to create a print CSS? Any way PHP can handle something like this?


I think you were on the right track with the CSS using a print style sheet. You have a great deal of control with CSS print styles. Here is a decent article on what styles should exist print media type.

You can open a window with your certificate and CSS print layout using JavaScript. You can also issue a window().print to automatically print a selected certificate.


There are definitely frameworks for generating PDFs in PHP as well, fpdf (for one) coupled with [url=]fpdi is very powerful.

With fpdi you can create a template of your cards (leave the sections you need to fill out blank), load the template, feed it to fpdf, and then write your text in the appropriate locations.

Samples of usage can be found at:


Dome good suggestions from cpradio but just in case you want to try something else I’ve worked with dompdf before.