Skip to main content

Add Margin to PDF in n8n

Add Margin to PDF is a PDF4me node action in n8n that adds left, right, top, and bottom margins to a PDF, each measured in millimetres. Use it to create binding space for printed reports, leave room for annotations on handouts, or bring incoming documents up to a house layout standard automatically.

What this node does

PDF4me: Add Margin To PDF takes a PDF from Binary Data, a Base64 String, or a URL and returns a new file with the four margin values you specify applied in millimetres. Each side is set independently, so an asymmetric binding margin is just a larger left value. Because it runs as a workflow step, the same margin standard can be applied to every document that arrives without anyone opening a desktop editor.

Related Blog Posts
No blog post yet for this feature — coming soon.
In the meantime, browse the PDF4me blog for tutorials and workflows across every platform.
Visit the blog

Authenticating Your API Request

Every PDF4me node in n8n requires a valid Credential to connect with. Create or select one that holds your PDF4me API key so the workflow can authenticate margin requests securely.

Important Facts You Should Not Miss

Every value is in millimetres
The fields are literally labelled (Mm). If your print spec is in inches, convert before entering: one inch is 25.4 mm.
All four sides are independent
Left, right, top, and bottom are separate fields, so an asymmetric binding margin needs nothing more than a larger left number.
Proof one file before a print run
How the result looks depends on the source page geometry, so run a representative document through once and check the output before sending a batch to print.
PDF4me node in n8n set to Action Add Margin To PDF, Input Data Type Binary Data, Input Binary Field data, Output File Name document_with_margins.pdf, Document Name document.pdf, and Left, Right, Top, Bottom Margin fields in millimetres

PDF4me Add Margin To PDF parameters panel in n8n

Automated Margins (n8n) vs a Desktop PDF Editor

Most results for this search are one-file-at-a-time editors. The difference is where the work happens.

ApproachTriggerBest fit
Desktop editor or online margin toolA person opens and adjusts one file by handA single document you are already working on
PDF4me Add Margin To PDF in n8nA generated report, an upload, or a scheduled batchApplying one house margin standard to every document that arrives, unattended

What Parameters Does Add Margin to PDF Need?

Required: Action, Input Data Type, the field matching that input type, Output File Name, Document Name, and all four margin values. Binary Data Output Name and Custom Profiles carry working defaults.

ParameterRequiredWhat it doesExample
ActionRequiredSelects the PDF4me node action to run. Choose Add Margin To PDF.Add Margin To PDF
Input Data TypeRequiredFormat of the source PDF input. Choose Binary Data (from a previous node), Base64 String, or URL.Binary Data
Input Binary FieldConditionalName of the binary property on the incoming n8n item that holds the PDF. Required when Input Data Type is Binary Data. Defaults to data.data
Base64 Document ContentConditionalBase64-encoded content of the source PDF. Required when Input Data Type is Base64 String.JVBERi0xLjQK...
File URLConditionalPublicly reachable HTTPS URL to the source PDF. Required when Input Data Type is URL.https://example.com/report.pdf
Output File NameRequiredFilename for the PDF returned with margins applied. Include the .pdf extension.document_with_margins.pdf
Document NameRequiredFilename of the source PDF, used for reference and tracking on the request.document.pdf
Left Margin (Mm)RequiredLeft margin width in millimetres. Set this larger than the other sides when you need binding space.20
Right Margin (Mm)RequiredRight margin width in millimetres.20
Top Margin (Mm)RequiredTop margin height in millimetres. Increase it when a printed header or letterhead needs clearance.25
Bottom Margin (Mm)RequiredBottom margin height in millimetres. Increase it when a footer or page number needs clearance.25
Binary Data Output NameOptionalName of the binary property the output item exposes. Defaults to data.data
Custom ProfilesOptionalAdvanced Options field for extra processing settings, supplied in a JSON-like format. Leave blank unless you have a specific profile to apply.{ "preserveContentQuality": true }

Output Fields

A successful run returns one n8n item carrying the PDF with margins applied.

FieldTypeWhat it contains
Binary (data)BinaryThe PDF with the four margin values applied, under Binary Data Output Name (default data).
fileNameStringGenerated filename, matching Output File Name.
mimeTypeStringMIME type of the output, always application/pdf.
fileSizeNumberSize of the returned PDF in bytes.
pageCountNumberNumber of pages processed with margin adjustments.
successBooleanTrue when the margin operation completed, false on failure. Use it to branch error handling.
messageStringHuman-readable status message, carrying success confirmation or error detail.

How Do I Set Up Add Margin to PDF in n8n?

  1. Add PDF4me to your n8n workflow and choose the Add Margin To PDF action.
  2. In Credential to connect with, select your PDF4me credential or click Create New Credential and paste your API key.
  3. Set Input Data Type to Binary Data (default), Base64 String, or URL and supply the matching source PDF field.
  4. Enter Left Margin (Mm), Right Margin (Mm), Top Margin (Mm), and Bottom Margin (Mm) in millimetres.
  5. Set Output File Name (must end in .pdf) and Document Name for the source file.
  6. Execute the node and route the returned PDF into the next step, such as storage, email, or a print queue.

Typical Setups

Workflow ExamplesCommon n8n workflow patterns using Add Margin to PDF.
Binding margin for printed reports
  1. A scheduled report is generated as a PDF overnight.
  2. Add Margin to PDF applies a wide left margin and narrower right, top, and bottom values.
  3. The result goes to the print queue with room for spiral or comb binding.
Annotation space on handouts
  1. Training material is uploaded to a shared folder.
  2. Add Margin to PDF widens the right margin so readers have space for notes.
  3. The annotated-ready copy is distributed to attendees.
House layout standard on incoming files
  1. A webhook receives PDFs from an external supplier with inconsistent layouts.
  2. Add Margin to PDF applies the same four values to every file.
  3. Documents enter the archive with a uniform page presentation.
Margin then page numbers
  1. A merged document is assembled from several sources.
  2. Add Margin to PDF creates bottom clearance first.
  3. Add Page Number to PDF then places numbering inside the new footer space.

Practical Tips

Convert inches before you type
The fields only accept millimetres. A one inch margin is 25.4 and a half inch is 12.7, so convert a print spec once and reuse the numbers.
Add margin before adding page numbers
Creating the bottom clearance first gives a page number or footer stamp somewhere clean to sit, rather than crowding existing content.
Proof a representative file, not the simplest one
Pick a document with dense edge-to-edge content for the test run, since that is where a margin change is most visible.
Use an asymmetric left value for binding
Anything that will be bound, punched, or stapled needs more room on the binding edge than on the outer edge.
Split first if pages need different margins
The values apply across the document, so a mixed layout needs a split, per-part margin run, and merge back together.
Branch on the success field
Test the returned success boolean before sending the file onward so a failed run raises an alert instead of quietly forwarding the original.

Cheat Sheet

FieldValue
ActionAdd Margin To PDF
Input Data TypeBinary Data
Input Binary Fielddata
Output File Namedocument_with_margins.pdf
Document Namedocument.pdf
Left / Right Margin (Mm)20 / 20
Top / Bottom Margin (Mm)25 / 25
Binary Data Output Namedata
CredentialsPDF4me API credential

Common Questions

What unit are the PDF margin values in?+
All four margin fields are measured in millimetres, which is why they are labelled Left Margin (Mm), Right Margin (Mm), Top Margin (Mm), and Bottom Margin (Mm). If your source specification is in inches, convert first: one inch is 25.4 mm, so a one inch margin is entered as 25.4.
Does adding a margin shrink the page content or make the page bigger?+
Adding margin space changes the relationship between the content area and the page edge, which in PDF terms means the boundaries described in the ISO 32000 PDF specification. Run the node once on a representative file and inspect the output before committing a print run, because the visual result depends on the source page geometry.
Can I set a different margin on only one side?+
Yes. The four margin fields are independent, so you can set a wide binding margin on the left and leave the other three small. A common binding setup is a larger left value with matching smaller right, top, and bottom values.
Do the margins apply to every page in the document?+
The margin values you supply are applied across the document rather than to a single selected page. If different pages need different treatment, split the PDF first, run Add Margin to PDF on each part with its own settings, then merge the results back together.
Why would I automate margins instead of setting them in Acrobat?+
A desktop tool is fine for one file you already have open. Automation matters when margins must be applied consistently to every document that arrives, for example every report generated overnight or every file dropped into a print folder. In an n8n workflow that becomes a single step nobody has to remember.

Same Task on Other Platforms

Get Help