I need to code a PHP script that would let me generate a pdf file which displays a member ID card (something like a credit card used to identify oneself) at a certain resolution.
Let me explain:
I do have the basic blueprint of the card in png file format. The script needs to drop in a member's name and birthday along with a serial. So far, no problem - there are plenty of good working PHP libraries out there.
My problem is to ensure that the resulting pdf (the generated image of the card, to be precise) meets a certain resolution (preferably 300dpi), so that printing it would look right.
Any ideas?
EDIT
I solved it using the TCPDF library which lets you scale images at a certain resolution.
Get it here: http://www.tecnick.com/public/code/cp_dpage.php?aiocp_dp=tcpdf
EDIT @Don
require_once(dirname(__FILE__).'/tcpdf/config/lang/eng.php');
require_once(dirname(__FILE__).'/tcpdf/tcpdf.php');
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT,
true, 'UTF-8', false);
// set document information
$pdf->SetCreator('SO-youth');
// remove default header/footer
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
//set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
//set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set font
$pdf->SetFont('courier', '', 10);
// add a page
$pdf->AddPage();
// set JPEG quality
$pdf->setJPEGQuality(100);
$cred = <<<EOT
<p>
<b>{$userdata->first_name} {$userdata->last_name}</b><br/>
<span style="font-size: 80%;">{$userdata->geburtstag}</span>
</p>
EOT;
$id = <<<EOT
<span style="font-size: 60%;">{$userdata->club_id}</span>
EOT;
$pdf->Image(dirname(__FILE__).'/img/clubcard.jpg',
10, 10, 85.6, 53.98, null, null, null, false, 300);
$pdf->writeHTMLCell(60, 15, 50.5, 20.5, $cred);
$pdf->writeHTMLCell(50, 20, 77, 50.5, $id);
//Close and output PDF document
$pdf->Output($userdata->filename, 'F');