// Include the PDF library require('fpdf.php'); // Create a new PDF document $pdf = new FPDF(); // Add the first page $pdf->AddPage(); // Add content to the first page $pdf->SetFont('Arial','B',16); $pdf->Cell(40,10,'Hello World!'); // Add a second page $pdf->AddPage(); // Add content to the second page $pdf->SetFont('Arial','B',16); $pdf->Cell(40,10,'This is page 2'); // Output the PDF document $pdf->Output();
// Include the PDF library require_once('tcpdf.php'); // Create a new PDF document $pdf = new TCPDF(); // Add the first page $pdf->AddPage(); // Add content to the first page $pdf->SetFont('times','',12); $pdf->WriteHTML('This example also shows how to add two pages to a PDF document, but it uses the TCPDF package/library instead. Package/Library: TCPDFWelcome to my PDF document
'); // Add a second page $pdf->AddPage(); // Add content to the second page $pdf->SetFont('times','',12); $pdf->WriteHTML('This is the second page of my PDF document
'); // Output the PDF document $pdf->Output();