API V2

Convert Url to PDF

Connector ID: URL To PDF

Transforms HTML code or web pages into PDF documents.
Supports embedded content such as images, CSS styles, and JavaScript elements.

Converts not only static HTML templates but also entire URLs, making it easy to turn dynamic web pages into PDFs.

Keeps the layout, styles, and structure of the original HTML or web page, ensuring that the PDF looks as close to the original as possible.

Customization Options

Allows customization of page size (A4, Letter, etc.), margins, headers, footers, and more, enabling control over the output format.
Interactive Elements:

Can potentially retain interactive elements like links and buttons within the PDF, making it not just a static document but one that maintains some level of interactivity.

Easy to Use

User-friendly interface or API that enables users or developers to quickly convert HTML content into PDF without needing technical expertise.

Accessibility

Produces portable documents that are universally accessible across devices and platforms, maintaining compatibility with PDF readers.

Use Cases

Generating Reports: Automatically convert dynamic web-based reports into PDF for sharing or archiving.
Offline Access: Allow users to download web pages for offline viewing.
Documenting Web Content: Create PDF versions of web pages for legal, marketing, or archival purposes.
Email Attachments: Convert HTML email templates into PDFs for easy sharing and viewing across platforms.

  • Method: POST
  • Endpoint: /api/v2/ConvertUrlToPdf

Parameters

Web URLString, Required

Web URL of the page that needs to be converted as PDF.
Example - https://www.google.com

Auth TypeString, Required

Specify the authentication type required to access the website URL, if applicable. Some websites may require authentication methods such as Basic Authentication, OAuth, or API keys before allowing access. If no authentication is needed, this field can be left blank.

UsernameString, Required

Enter the username if authentication is required to access the website or resource. This is typically used along with a password or token, depending on the authentication method.
For example, entering userName will supply the required username for login.

PasswordString, Required

Enter the password for the PDF file. The password must be provided in string format. This will be required to open or process the protected PDF.
For example, entering 1234 will set or use 1234 as the password for the PDF file.

File contentBase64, Required

Map the Base PDF File Content

File NameString, Required

Top layer PDF file name with extension

LayoutString, Required
  • Landscape – The page will be oriented horizontally, wider than it is tall.
  • Portrait – The page will be oriented vertically, taller than it is wide.
FormatString, Required
Default: A4

You can select any one format -

  • A0, A1, A2, A3, A4, A5, A6, A7, A8
  • Tabloid
  • Legal
  • Statement
  • Executive
Scaledecimal, Required

Specify the scale for the URL-to-PDF conversion. The value must be provided in decimal format, where 1.0 represents 100% (original size). Smaller values reduce the content size, while larger values (up to the supported limit) enlarge it.
For example, entering 0.8 will scale the PDF content to 80% of its original size.

Top MarginString, Required

Specify the top margin of the PDF file. The value must be provided in string format along with a valid unit (e.g., px, in, cm). This margin defines the space between the top edge of the page and the content.
For example, entering 40px will set a top margin of 40 pixels, pushing the content downward from the top edge of the page.

Left MarginString, Required

Specify the left margin of the PDF file. The value must be provided in string format along with a valid unit (e.g., px, in, cm). This margin defines the space between the left edge of the page and the content.
For example, entering 40px will set a left margin of 40 pixels, shifting the content inward from the left edge of the page.

Right MarginString, Required

Specify the right margin of the PDF file. The value must be provided in string format along with a valid unit (e.g., px, in, cm). This margin defines the space between the right edge of the page and the content.
For example, entering 40px will set a right margin of 40 pixels, shifting the content inward from the right edge of the page.

Bottom MarginString, Required

Specify the bottom margin of the PDF file. The value must be provided in string format along with a valid unit (e.g., px, in, cm). This margin defines the space between the bottom edge of the page and the content.
For example, entering 40px will set a bottom margin of 40 pixels, pushing the content upward from the bottom edge of the page.

Print BackgroundBoolean, Required
Default: true
  • Selecting true will print the background elements (such as colors, patterns, or images) along with the page content.
  • Selecting false will exclude the background, and only the main text and elements will be included in the PDF.
Display Header FooterBoolean, Required
Default: true
  • Selecting true will include headers and footers (such as page numbers, titles, or other predefined information) in the PDF.
  • Selecting false will exclude headers and footers, showing only the main content.

Output

File ContentBase64, Required

Output file content from PDF4me action

File NameString, Required

Output file name from PDF4me action

Header
Content-Type:application/json
Authorization: Please copy key from the link.

Payload

{
  "webUrl": "https://www.google.com",
  "authType": "NoAuth",
  "username": "userName",
  "password": "1234",
  "docContent": "Please put PDF base64 content",
  "docName": "output.pdf", 
  "layout": "landscape",
  "format": "A4",
  "scale": 0.8,
  "topMargin": "40px",
  "leftMargin": "40px",
  "rightMargin": "40px",
  "bottomMargin": "40px",
  "printBackground": true,
  "displayHeaderFooter": true		
}

PDF4me api samples

CSharp(C#)
Java
JavaScript
Python
Salesforce
n8n
Google Script
AWS Lambda