How to Create a PDF From HTML

Save

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.

Use an Online PDF Conversion Service

  • Use an online PDF conversion site such as HTML 2 PDF or PDF On the Fly.

  • Upload the HTML form using the online form or enter the URL of the HTML page that you want to convert.

  • Click on the button to convert your HTML.

  • Click on the link generated to download the PDF version of your HTML file.

Use a PDF Conversion Software

Create Your Own PDF Conversion Application Using DOMPDF

  • Download the DOMPDF PHP package.

  • Upload the files in a directory on your PHP Web server.

  • Edit the configuration file to fit your settings.

  • 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");

    ?>

  • Save the PHP file and upload it on your Web server. Access the file to convert the HTML to a PDF file.

References

  • Photo Credit Monkey Business Images Ltd/Valueline/Getty Images
Promoted By Zergnet

Comments

Resources

You May Also Like

  • How to Create a PDF with Editable Fields

    Portable Document Format (PDF) documents are the leading file type for storing accessible documents on the Internet. Many organizations and government offices...

  • How to Convert HTML to PDF Using PHP

    PDF or Portable Document Format is a popular file type that is often used for online documents. It's great for distributing downloadable...

Related Searches

Check It Out

Geek Vs Geek: Robot battles, hoverboard drag race, and more

M
Is DIY in your DNA? Become part of our maker community.
Submit Your Work!