How to Create a PDF From HTML
Portable Document Format or PDF is a file format that is popularly used online for distributing documents. Unlike DOC files that can only be opened using Microsoft Word, PDF is platform independent and it allows for the distribution of non-editable material. You can create PDF files using various programs, the most popular one being Adobe Acrobat. If you do not have PDF authoring software, another option is to create it using HTML and convert it into a PDF file using an online service or a desktop application.
Instructions
-
Use an Online PDF Conversion Service
-
1
Use an online PDF conversion site such as HTML 2 PDF or PDF On the Fly.
-
2
Upload the HTML form using the online form or enter the URL of the HTML page that you want to convert.
-
-
3
Click on the button to convert your HTML.
-
4
Click on the link generated to download the PDF version of your HTML file.
Use a PDF Conversion Software
-
5
Download a PDF conversion program such as PDF Ripper or the Free HTML to PDF Converter.
-
6
Install the program on your computer.
-
7
Open the application and follow the instructions to convert your HTML file into a PDF.
Create Your Own PDF Conversion Application Using DOMPDF
-
8
Download the DOMPDF PHP package.
-
9
Upload the files in a directory on your PHP Web server.
-
10
Edit the configuration file to fit your settings.
-
11
Open Notepad. Create a PHP page that makes use of the DOMPDF script and include the HTML code that you wish to convert. For example:
<?php
require_once("dompdf_config.inc.php");
$html =
'<html><body>'.
'<p>Put your html here.</p>'.
'</body></html>';
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream("mypdf.pdf");
?>
-
12
Save the PHP file and upload it on your Web server. Access the file to convert the HTML to a PDF file.
-
1
References
Resources
- Photo Credit Monkey Business Images Ltd/Valueline/Getty Images