PDF certificate [message #175535] |
Wed, 05 October 2011 04:31 |
bob
Messages: 11 Registered: February 2011
Karma: 0
|
Junior Member |
|
|
I need to write a PHP script that e-mails a PDF certificate (not
cryptography… just a congrats cert) to someone. The certificate
needs to have the person's name and address on it, so the PHP script
must modify the PDF. Any ideas on how to do this?
|
|
|
Re: PDF certificate [message #175536 is a reply to message #175535] |
Wed, 05 October 2011 09:58 |
Erwin Moller
Messages: 228 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On 10/5/2011 6:31 AM, bob wrote:
> I need to write a PHP script that e-mails a PDF certificate (not
> cryptography… just a congrats cert) to someone. The certificate
> needs to have the person's name and address on it, so the PHP script
> must modify the PDF. Any ideas on how to do this?
>
Start reading here:
http://nl.php.net/manual/en/book.pdf.php
Good luck!
Regards,
Erwin Moller
--
"That which can be asserted without evidence, can be dismissed without
evidence."
-- Christopher Hitchens
|
|
|
Re: PDF certificate [message #175537 is a reply to message #175535] |
Wed, 05 October 2011 14:03 |
Jeff North
Messages: 58 Registered: November 2010
Karma: 0
|
Member |
|
|
On Tue, 4 Oct 2011 21:31:59 -0700 (PDT), in comp.lang.php bob
<bob(at)coolgroups(dot)com>
<65431589-b803-4bff-9946-0dae668058cd(at)j1g2000yqj(dot)googlegroups(dot)com>
wrote:
> | I need to write a PHP script that e-mails a PDF certificate (not
> | cryptography
just a congrats cert) to someone. The certificate
> | needs to have the person's name and address on it, so the PHP script
> | must modify the PDF. Any ideas on how to do this?
I use tcpdf (http://www.tcpdf.org).
To save yourself a lot of work; create an image of your certificate.
You can use this as a background for the PDF page.
require_once('tcpdf/tcpdf.php');
class myPDF extends TCPDF {
//---- set custom header and footer
public function Footer() {}
}
$pdf = new myPDF('L','mm','LETTER');
$pdf->SetAuthor("...");
$pdf->SetCreator("..");
$pdf->SetTitle("...");
$pdf->SetSubject("....");
$pdf->SetKeywords("...");
//--- set the margins to zero
$pdf->SetMargins(0,0,0,true);
$pdf->SetAutoPageBreak(false, PDF_MARGIN_BOTTOM);
//--- use an image for the background
$pdf->Image("images/cert1.gif", 0, 0, 279.25, 215.5, 'gif');
//--- position and output custom text
$pdf->SetFont('Helvetica','B',24);
$pdf->SetXY( 35, 21 ); $pdf->Cell(130, 0, $sName, 0, 0, 'L');
....
....
//--- output the page
$pdf->Output("results/pdf/".$code.".pdf", "F");
|
|
|