HTML File to PDF Converter

Converter
html file to pdf

Step 1: Select your .html, .htm, .xhtml or xht file to convert it to a PDF file.

Step 2: Click the "Select File" button, Dropbox button or drag and drop your file.

Step 3: Configure the output settings and click the "Convert" button.

Please Wait... while we get the Dropbox file.

Upload Complete
- or - Upload a Different File
Drag & Drop a File Here
-or-
-or-
Output Settings:

  • Margin Top
  • Margin Bottom
  • Should we load images?
  • Margin Left
  • Margin Right
  • Should we allow javascript to run?
Save Settings Reset form values

FAQs

HTML files offer some of the most flexibility due this converter being able to render css, javascript, images and more. But for this to work, it is recommended that all of the URLs within links, css, tags, javascript code etc., use absolute remote paths. For example, an absolute path looks like this "https://topdf.org/files" while a relative path looks like "/files". So if your file uses relative paths, within let's say, an <img> tag, your PDF will have a broken image where that tag appears on the page. Therefore, it is highly recommended that you always use relative paths and always make sure that your images, stylesheets, javascript pages etc., exist on the web.

It is also recommended that you use common HTML code structure. Always add <html>, <head> and <body> tags. In addition to these tags, it is highly recommended that you add the meta charset tag to your file as well. If you leave the meta charset tag out, we will assume that the encoding is UTF-8 and if it's not, some text might not render properly.

There is also a way that you can create a PDF with multiple pages. So if you're looking to create a manual, book, slideshow etc., you can do this by adding the "page-break-after" css property. So you would basically create one html file, add content to it and then add the css class containing the "page-break-after" property to a div that would split your html code into pages. Here is an example:

<style type="text/css">
.pagebreak {
display: block;
clear: both;
page-break-after: always;
}
</style>

<div>Your 1st page text.</div>
<div class="pagebreak"></div>
<div>Your 2nd page of text.</div>
<div class="pagebreak"></div>
<div>Your 3rd page of text.</div>


The end result will be a PDF with 3 pages. Your first page will contain the text "Your 1st page text.", 2nd page will contain "Your 2nd page of text." and your 3rd page will contain "Your 3rd page of text.". Keep in mind that you can add images and/or text. You can also format and style your text using css any way that you like.

PDF Conversion Tools

In addition to HTML files, you can also convert files to PDF which are in another format. Below you will also find tools for converting webpages and creating your own PDF:

If you'd prefer to convert online based webpages rather than HTML files, see the URL to PDF converter which is a lot quicker and easier to use.

The HTML code to PDF converter can be used to paste and convert HTML code or you can use the WYSIWYG on the page to easily write your code.

XML file to PDF converter can convert XML files which end in the extension .xml.

Word document to PDF converter can convert Word documents which end in the extensions .doc, .docx or .odt.

Excel document to PDF converter can convert spreadsheets which end in the extensions .xls or .xlsx.

Powerpoint file to PDF converter can convert presentations to PDFs which end in the extensions .ppt or .pptx.

Rich text file to PDF converter can convert files which end in the extension .rtf.

Text file to PDF converter can convert plain text files which end in the extension .txt.

CSV file to PDF converter can convert comma-separated text files which end in the extension .csv.

Free PDF Invoice Generator can create PDF invoices for you quickly and easily.