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
- Split PDF By Barcode
- 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
- Split PDF By Swiss QR
- 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 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, a base64 encoded string, 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 archiving.
- Adjusting margins on dynamically generated reports to fit printing templates.
- Preparing PDFs for binding by increasing left or right margins.
Properties
| Name | Meaning |
|---|---|
| Input Data Type | Method to provide the PDF: "Binary Data" (from previous node), "Base64 String" (base64 encoded PDF content), or "URL" (link to PDF file). |
| Input Binary Field | Name of the binary property containing the PDF file (used if Input Data Type is "Binary Data"). |
| Base64 PDF Content | Base64 encoded string representing the PDF document (used if Input Data Type is "Base64 String"). |
| PDF URL | URL to the PDF file to add margins to (used if Input Data Type is "URL"). |
| Output File Name | Desired filename for the output PDF with added margins. |
| Document Name | Reference name for the source PDF file. |
| Left Margin (Mm) | Size of the left margin in millimeters (0-100). |
| Right Margin (Mm) | Size of the right margin in millimeters (0-100). |
| Top Margin (Mm) | Size of the top margin in millimeters (0-100). |
| Bottom Margin (Mm) | Size of the bottom margin in millimeters (0-100). |
| Advanced Options | Optional JSON string to specify custom profiles and additional API options for advanced margin adjustments. |
| Binary Data Output Name | Custom name for the binary data field in the node's output. |
Output
The node outputs the modified PDF file with the specified margins applied. The output includes:
- A JSON object containing metadata about the processed file.
- A binary data field containing the PDF file with the new margins applied. The name of this binary field 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, applies margins, and outputs the resulting PDF similarly.
Dependencies
- Requires access to an external PDF processing service or API capable of adding margins to PDF files.
- Needs proper API authentication configured in n8n (e.g., an API key credential).
- Network access is required if using URL input type to fetch the PDF.
Troubleshooting
Common issues:
- Invalid or inaccessible PDF URL leading to download failures.
- Incorrect base64 string format causing decoding errors.
- Margins set too large may cause layout issues or errors in processing.
- Missing or incorrect binary property name when using binary input.
Error messages and resolutions:
- "Failed to fetch PDF from URL": Check the URL validity and network connectivity.
- "Invalid base64 content": Verify that the base64 string is correctly encoded and complete.
- "Margin values out of range": Ensure margin values are between 0 and 100 mm.
- "Binary property not found": Confirm the binary property name matches the actual input data.
Links and References
- PDF4me API Documentation — For advanced profile options and API capabilities related to PDF margin adjustments.