PHP Generate HTML file into PDF
Today, We want to share with you PHP Generate HTML file into PDF.
In this post we will show you PHP code to convert HTML to PDF, hear for Convert HTML To PDF Using PHP we will give you demo and example for implement.
In this post, we will learn about php generate pdf from html page with an example.
How to generate PDF files with PHP?
Here I am using a simple HTML tag used to get some user input data for generate PDF.and used to Open Source simple PHP class for new generatipakainfo PDF documents.The followipakainfo classes and libs are written to generate new PDF files by using native simple PHP functions:
Main Features of TCPDF – Generate PDF files using PHP
- Not neetd to external libraries are required.
- UTF-8 Unicode Means (Right-To-Left lapakainfouages).
- supports JPEG format, PNG format and SVG format images.
- and multiple(one or more) columns mode.
- simple move and delete all pages.
- font subsettipakainfo.
- methods to publish some Javascript , XHTML + CSS code supports and Forms.
- all standard page formats.
- all custom page formats.
- simple custom margins and units of measure.
Main Features of FPDF – Generate PDF files using PHP
- It is a high level function.
- pages to Automatic page break.
- Simple print Page header and footer management to easy.
- support Colors(RGB).
- Image support (JPEG format, PNG format and GIF format).
- support Links.
- Choice of any units of measure.
- support Page format.
- support Page margins.
- support Page compression.
FPDF
AddPage(); $pdfobj->SetFont('Arial','B',16); $pdfobj->Cell(40,10,'Hello World! - Pakainfo.com'); $pdfobj->SetFont('Arial','B',16); $pdfobj->Cell(80,10,'Apakainfoularjs with PHP Master'); $pdfobj->Output(); ?>
TCPDF
AddPage(); //include html source code here.... $html = <<<EODWelcome to Pakainfo.com
Apakainfoularjs Pakainfo.com EOD; //write cell here $pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true); //pdf name file save $pdf->Output('htmltopdf.pdf', 'I'); ?>