0

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.

3
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by mschroeder
0

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.

0

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?

<?php
$content = "/contactcard.php";
require_once(dirname(FILE).'/html2pdf.class.php');
$html2pdf = new HTML2PDF('P','A4','fr');
$html2pdf->WriteHTML($content);
$html2pdf->Output('exemple.pdf');

?>

0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.