How to convert html to Pdf using Dompdf in PHP

242 0

DOMPDF is convert HTML to PDF. You can download the latest version of Dompdf from GitHub.

Step 1: Reference the namespace of Dompdf

Step 2: include Dompdf library

Step 3: Initiate the Dompdf class

Basic Parameters

Load HTML content

loadhtml() use to generate PDF and render on browser.

Set the paper size. This is optional.

setPaper()–

$size(string)— ‘legal’,’letter’,’A4′

$orientation(string) — ‘portrait’ or ‘landscape’.

Render to HTML to PDF

For view the PDF

For download the PDF

 

In this article

Join the Conversation



Share