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

Step by step guide:

1. 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.

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

Choose AnythingToPDFConverter

2. Then, let’s configure the 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"
      } 
    } ] 
}

Setup AnythingToPDFConverter

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

Test AnythingToPDFConverter

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

Successful Test

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

Output Result
Screenshot of Output Result

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

Related Pages: