PDF4me icon

PDF4me

Comprehensive PDF and document processing: generate barcodes, convert files, extract data, manipulate images, and automate workflows with the PDF4ME API

Actions80

Overview

This node converts a web page URL into a PDF document. It is useful when you want to capture the content of any publicly accessible or authenticated webpage as a PDF file for archiving, sharing, or further processing. For example, you can convert an online article, a report dashboard, or a product page into a PDF format automatically within your workflow.

The node supports authentication for websites requiring basic login credentials and allows customization of the PDF layout, format, margins, scaling, and other advanced options to tailor the output PDF to your needs.

Properties

Name Meaning
Web URL The URL of the web page that you want to convert to PDF.
File Name The desired name of the output PDF file including the .pdf extension.
Authentication Type The type of authentication required by the target website: either no authentication or basic authentication.
Username Username for basic authentication if required by the website.
Password Password for basic authentication if required by the website.
Page Layout Orientation of the PDF pages: Portrait or Landscape.
Page Format Paper size format for the PDF, e.g., A4, A3, Legal, Tabloid, etc.
Advanced Options Collection of optional settings to fine-tune the PDF generation:
- Bottom Margin Bottom margin of the PDF page (e.g., "20px", "1cm", "0.5in").
- Custom Profiles JSON string to specify custom profile properties for the API call to adjust PDF generation behavior.
- Display Header Footer Boolean to show or hide header and footer in the PDF.
- Left Margin Left margin of the PDF page.
- Print Background Boolean to include background colors and images in the PDF.
- Right Margin Right margin of the PDF page.
- Scale Scale factor for rendering the web page (from 0.1 to 2).
- Top Margin Top margin of the PDF page.

Output

The node outputs the generated PDF file as binary data attached to the item under the binary property with the filename specified by the user. The json output contains metadata about the operation or may simply reflect the input data structure with added information about the conversion result.

  • binary: Contains the PDF file data.
  • json: Metadata or status information related to the conversion process.

Dependencies

  • Requires access to the internet to fetch the web page URL.
  • If the target website requires authentication, valid username and password must be provided.
  • Uses an external PDF conversion service API (implied by the code structure) which requires proper API credentials configured in n8n.
  • No explicit environment variables are mentioned, but API key or token configuration is necessary for the underlying PDF conversion service.

Troubleshooting

  • Authentication errors: If the website requires authentication and incorrect or missing credentials are provided, the conversion will fail. Ensure correct username and password are set when using Basic Authentication.
  • Invalid URL: Providing an invalid or unreachable URL will cause the node to error out. Verify the URL is correct and accessible from the n8n instance.
  • File naming issues: Ensure the file name ends with .pdf to avoid confusion or errors downstream.
  • API limits or failures: The underlying PDF conversion service might have rate limits or temporary outages. Check API usage quotas and service status if conversions fail unexpectedly.
  • Advanced options JSON syntax: When using custom profiles, ensure the JSON string is well-formed; otherwise, the API call may reject the request.

Links and References


If you need more details on specific advanced options or error handling, feel free to ask!

Discussion