I am trying to create a page of 8 avery labels for our users to print out.

The labels are to be used for our meetups, so the users can have there name, avatar, and background. These are all dynamically pulled from the database.

The user will have a link which shows "print label" when this is clicked, it should open a pdf file, which shows all of there details as mentioned above.

How would I go about constructing this? I have pulled all of the details onto a php and printed it as a single label, but i need to do this as multiple labels, with the formating for avery package labels.

Any help would be appreciated.

Recommended Answers

All 4 Replies

I have managed to load the labels into a css styled layout using inches for the avery dimensions, but I would now like to send this to a pdf document so they can be viewed on the page and printed from there.

ive tried that but it doesn't work, my contactcard.php is rendered in a seperate html file which uses html tags, head tag etc

how can i include that here?

$content = "/contactcard.php";
$html2pdf = new HTML2PDF('P','A4','fr');


If you have access to the server to install new libraries or if you have a server admin who can address this for you, I highly suggest looking at the pdftk library. http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/

Instead of trying to generate the entire page with php and get the styling correct, create a pdf form that has the labels laid out already, and form fields with the styling applied already. Then simply create an xfdf file (xml) with php and merge it with the templated pdf form using pdftk.

Perfect looking pdfs everytime. Don't forget to account for line lengths etc.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.