require_once('tcpdf/tcpdf.php'); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor('John Doe'); $pdf->SetTitle('Sample PDF Document'); $pdf->SetSubject('TCPDF Tutorial'); $pdf->SetKeywords('TCPDF, PDF, example, test'); $pdf->AddPage(); $pdf->SetFont('helvetica', 'B', 16); $pdf->Cell(0, 10, 'Welcome to TCPDF!', 0, 1); $pdf->Output('sample.pdf', 'D');
require('fpdf/fpdf.php'); $pdf = new FPDF(); $pdf->AddPage(); $pdf->SetFont('Arial','B',16); $pdf->Cell(40,10,'Hello World!'); $pdf->Output();
require_once 'dompdf/autoload.inc.php'; use Dompdf\Dompdf; $dompdf = new Dompdf(); $dompdf->loadHtml('In conclusion, as described above, TCPDF, FPDF, and DOMPDF are the popular PHP package libraries for rendering PDFs.Welcome to DOMPDF!
This is a PDF file generated from HTML code.
'); $dompdf->setPaper('A4', 'landscape'); $dompdf->render(); $dompdf->stream('dompdf.pdf');