Actions80
- Add Attachment To PDF
- Add Barcode To PDF
- Add Form Fields To PDF
- Add HTML Header Footer
- Add Image Stamp To PDF
- Add Image Watermark To Image
- Add Margin To PDF
- Add Page Number To PDF
- Add Text Stamp To PDF
- Add Text Watermark To Image
- AI-Invoice Parser
- AI-Process Contract
- AI-Process HealthCard
- Classify Document
- Compress Image
- Compress PDF
- Convert HTML To PDF
- Convert Image Format
- Convert JSON To Excel
- Convert Markdown To PDF
- Convert PDF To Editable PDF Using OCR
- Convert PDF To Excel
- Convert PDF To PowerPoint
- Convert PDF To Word
- Convert To PDF
- Convert URL to PDF
- Convert VISIO
- Convert Word to PDF Form
- Create Images From PDF
- Create PDF/A
- Create Swiss QR Bill
- Crop Image
- Delete Blank Pages From PDF
- Delete Unwanted Pages From PDF
- Disable Tracking Changes In Word
- Enable Tracking Changes In Word
- Extract Attachment From PDF
- Extract Form Data From PDF
- Extract Pages From PDF
- Extract Resources
- Extract Table From PDF
- Extract Text By Expression
- Extract Text From Word
- Fill PDF Form
- Find And Replace Text
- Flip Image
- Flatten PDF
- Generate Barcode
- Generate Document Single
- Generate Documents Multiple
- Get Document From Pdf4me
- Get Image Metadata
- Get PDF Metadata
- Get Tracking Changes In Word
- Image Extract Text
- Linearize PDF
- Merge Multiple PDFs
- Overlay PDFs
- Parse Document
- Protect PDF
- Read Barcode From Image
- Read Barcode From PDF
- Read SwissQR Code
- Remove EXIF Tags From Image
- Repair PDF Document
- Replace Text With Image
- Replace Text With Image In Word
- Resize Image
- Rotate Document
- Rotate Image
- Rotate Image By EXIF Data
- Rotate PDF Page
- Sign PDF
- Split PDF By Barcode
- Split PDF By Swiss QR
- Split PDF By Text
- Split PDF Regular
- Unlock PDF
- Update Hyperlinks Annotation
- Upload File To PDF4me
Overview
The node provides functionality to add margins to PDF documents. It supports multiple input methods for the source PDF, including binary data from a previous node, base64-encoded strings, or a URL pointing to the PDF file. Users can specify custom margin sizes for all four sides (left, right, top, bottom) in millimeters. This operation is useful when you need to adjust the whitespace around the content of a PDF, for example, to prepare documents for printing with specific margin requirements or to ensure consistent layout across different PDFs.
Practical examples:
- Adding uniform margins to scanned PDFs before printing.
- Increasing margins on digital reports to improve readability.
- Preparing PDFs for binding by adding extra space on one side.
Properties
| Name | Meaning |
|---|---|
| Input Data Type | Choose how to provide the PDF file to add margins to. Options: Binary Data (from previous node), Base64 String (directly provide base64 encoded PDF content), URL (link to PDF file). |
| Input Binary Field | Name of the binary property containing the PDF file (used only if Input Data Type is Binary Data). |
| Base64 PDF Content | Base64 encoded string representing the PDF document content (used only if Input Data Type is Base64 String). |
| PDF URL | URL to the PDF file to add margins to (used only if Input Data Type is URL). |
| Output File Name | Desired name for the output PDF file with added margins. Defaults to "document_with_margins.pdf". |
| Document Name | Name of the source PDF file for reference purposes. Defaults to "document.pdf". |
| Left Margin (Mm) | Size of the left margin in millimeters. Accepts values between 0 and 100. Default is 20 mm. |
| Right Margin (Mm) | Size of the right margin in millimeters. Accepts values between 0 and 100. Default is 20 mm. |
| Top Margin (Mm) | Size of the top margin in millimeters. Accepts values between 0 and 100. Default is 25 mm. |
| Bottom Margin (Mm) | Size of the bottom margin in millimeters. Accepts values between 0 and 100. Default is 25 mm. |
| Advanced Options | Collection for additional settings. Currently supports "Custom Profiles" where users can provide JSON to adjust extra properties for the API call, such as output data format. |
| Binary Data Output Name | Custom name for the binary data field in the node's output. Defaults to "data". |
Output
The node outputs the processed PDF file with the specified margins added. The output includes:
- A JSON object containing metadata about the operation.
- A binary data field containing the resulting PDF file with margins applied. The binary field name can be customized via the "Binary Data Output Name" property.
If the input was binary or base64, the output will be a binary PDF file ready for further processing or saving. If the input was a URL, the node downloads the PDF, adds margins, and outputs the modified PDF similarly.
Dependencies
- Requires access to an external PDF processing service or API that performs the margin addition operation.
- Needs proper API authentication configured in n8n (e.g., an API key credential).
- Network access is required if using URL input type or calling the external API.
Troubleshooting
Common issues:
- Invalid or inaccessible PDF URL: Ensure the URL is reachable and points directly to a valid PDF file.
- Incorrect base64 content: Verify the base64 string is correctly encoded and represents a valid PDF.
- Margin values out of range: Margins must be between 0 and 100 mm; values outside this range may cause errors.
- Missing or invalid API credentials: Confirm that the API key or authentication token is properly set up in n8n.
Error messages:
- "Failed to fetch PDF from URL": Check network connectivity and URL correctness.
- "Invalid PDF content": Validate the input PDF data or base64 string.
- "API authentication failed": Recheck API credentials and permissions.
- "Margin value out of bounds": Adjust margin inputs to allowed ranges.
Resolving these typically involves verifying input data formats, ensuring correct configuration of credentials, and confirming network accessibility.
Links and References
- PDF4me API Documentation — For advanced options and custom profiles.
- General information on PDF margin adjustments and use cases can be found in PDF editing tool documentation or printing guidelines.