This section contains the detail about the Save PDF in folder.
Save PDF in folder
In this tutorial you will learn how to save PDF in folder in a PHP web application. In this tutorial use
- save-pdf-in-folder.php.
 - fpdf16 folder (PDFlib).
 - pdffile folder.
 
The code 'save-pdf-in-folder.php' given below :
<?php
require('fpdf16/fpdf.php');
class SimpleTable extends FPDF
{
function generateTable($no)
{
for($i=1;$i<=10;$i++)
{
$this->cell(20,10,$no,1,0,"C");
$this->cell(20,10," * ".$i,1,0,"C");
$this->cell(20,10," = ".$i*$no,1,1,"C");
}
}
}
$pdf=new SimpleTable();
$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$pdf->generateTable(5);
$dir='C:/wamp/www/pdf-php-tutorial/pdffile/';
$filename= "filename.pdf";
$pdf ->Output($dir.$filename);
echo "Save PDF in folder";
?>
In the 'save-pdf-in-folder.php' create SimpleTable class that extends FPDF class and generateTable() function that create table with cell content. The generated PDF save in "C:/wamp/www/pdf-php-tutorial/pdffile/" directory and PDF name "filename.pdf" .
Output :
When run 'save-pdf-in-folder.php' file generate PDF and store in "C:/wamp/www/pdf-php-tutorial/pdffile/" directory and display output message as :

When open folder "pdffile" display PDF as :


						
[ 0 ] Comments