Today I will explain how to create PDF on the fly with php!
First download the library from here http://www.fpdf.org/ FPDF.
Copied to the root directory of your server.
Create a file CreatorePdf.php and stick the following code:
require('fpdf/fpdf.php');
<?
//create a new object pdf
$pdf=new FPDF();
/ / set the file properties
$pdf->SetAuthor('Author');
$pdf->SetTitle("Questo è il titolo del Pdf");
/ / set font for the entire document
$pdf->SetFont('Helvetica','B',20);
$pdf->SetTextColor(50,60,100);
//create the page
$pdf->AddPage('P');
$pdf->SetDisplayMode(real,'default');
/ / Create a title with an edge
$pdf->SetXY(50,20);
$pdf->SetDrawColor(50,60,100);
$pdf->Cell(100,10,'Testo centrato',1,0,'C',0);
$pdf->SetXY (10,50);
$pdf->SetFontSize(10);
$pdf->MultiCell(200,10,"Scrivete qui il corpo della pagina");
/ / Export the file
?>
As you can see nothing difficult!
Good Job!
Nessun commento:
Posta un commento