Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*download fpdfi at - http://www.setasign.com/products/fpdi/downloads/
- and fpdf at - http://www.fpdf.org/
- original code example - http://stackoverflow.com/questions/7364/pdf-editing-in-php
- because this example doens't work for me, I made a new one*/
- require_once('fpdf.php');
- require_once('fpdi.php');
- $pdf = new FPDI();
- $pdf->AddPage();
- $pdf->setSourceFile('file.pdf');
- // import page 1
- $tplIdx = $pdf->importPage(1);
- //use the imported page and place it at point 0,0; calculate width and height
- //automaticallay and ajust the page size to the size of the imported page
- $pdf->useTemplate($tplIdx, 0, 0, 0, 0, true);
- // now write some text above the imported page
- $pdf->SetFont('Arial', '', '13');
- $pdf->SetTextColor(0,0,0);
- //set position in pdf document
- $pdf->SetXY(30, 25);
- //first parameter defines the line height
- $pdf->Write(0, 'gift code');
- //force the browser to download the output
- $pdf->Output('file_generated.pdf', 'D');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement