How to Set Custom Paper Size and Margin for HTML to PDF or URL to PDF Generation with PDF.co and Zapier

PDF.co HTML to PDF is a web-based tool that converts HTML pages or URLs to PDF files. This tool can be accessed through a web browser and does not require any software installation. Users simply need to enter the URL of the website or upload the HTML file they want to convert, and the tool will generate a high-quality PDF file.

Note: If you are a developer, check out our API docs and explore over 300+ integrations.

In this HTML to PDF tutorial, we will show you how to set custom Paper Size and Margin to a PDF document. We will use a Raw HTML Code as our Source Input to generate the Output PDF.

Step 1: Open PDF.co and Select Anything to PDF Converter

To start, let’s set PDF.co as the App and Anything to PDF Converter as the Action Event.

Anything to PDF Converter screenshot

Step 2: Configure Anything to PDF Converter

Anything to PDF Converter converts our HTML code to PDF. This is where we can also set up custom profiles.

  • In the Input Type field, select Raw HTML code.
  • In the Input field, paste the HTML code.
  • In the Name field, type in your desired output filename.
  • In the Custom Profiles field, enter the Margin’s 4 sides and Paper Size. Paper Size can be set to A4, Letter, custom size, etc. Check out our API docs for other Paper Size options.
{
  "profiles": [
    {
      "profile1": {
        "Margins": "30px 10px 30px 10px",
        "paperSize": "A5"
      }
    }
  ]
}
Set up action screenshot

Step 3: Test Action

We are now ready to Test & Review our data and send it to PDF.co.

Test action screenshot

Step 4: Copy & Paste URL to Browser to View Output

PDF.co has processed our request and generated a temporary URL to access the result. Kindly copy and paste the URL to see the output.

Test action successful screenshot

Step 5: Generated PDF Output

Excellent! We have converted an HTML code to PDF and set the PDF’s Margin and Paper Size according to our requirements.

Screenshot of Output Result
Screenshot of Output Result

You can set up the next step to save the generated file in Google Drive or Dropbox depending on your requirement.

You just learned how to set up a custom paper size and margin for HTML to PDF or URL to PDF generation using PDF.co and Zapier. This is just one of the dozens of useful tutorials that we have for creating, converting, and customizing PDFs. Here are a few more others:

Note: If you are a developer, check out our API docs and explore over 300+ integrations.

Video Guide

Related Tutorials

See Related Tutorials