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 here and explore over 300+ integrations here.

  1. Open PDF.co and Select Anything to PDF Converter
  2. Configure Anything to PDF Converter
  3. Test Action
  4. Copy & Paste URL to Browser to View Output
  5. Generated PDF Output

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.

Set Anything To PDF Converter As The Action

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. You can check out the custom profiles doc here.

  • 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 here for other Paper Size options.

{
  "profiles": [
    {
      "profile1": {
        "Margins": "30px 10px 30px 10px",
        "paperSize": "A5"
      } 
    }                                                                                                                                                  
]                                                          
}

Configure Anything To PDF Converter To Take Raw HTML Code

Step 3: Test Action

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

Test Anything To PDF Converter Data

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.

PDF.co Generated URL

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.

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 here and explore over 300+ integrations here.