Skip to main content

Repair PDF Document in n8n

Repair PDF Document is a PDF4me node action in n8n that fixes structural errors in a corrupted or damaged PDF and recovers as much readable content as possible. Use it to rescue email attachments that will not open, restore damaged archive files, or recover documents broken by a failed transfer, all without a manual desktop repair tool.

What this node does

PDF4me: Repair PDF Document takes a corrupted or damaged PDF from Binary Data, a Base64 String, or a URL, and returns a rebuilt file with structural errors fixed and readable content recovered wherever the underlying data survives. It is the automated equivalent of the manual repair tools people reach for by hand, except it runs unattended inside a workflow triggered by an email attachment, a cloud storage upload, or a failed file transfer.

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 repair requests securely.

Important Facts You Should Not Miss

Only three fields are truly required
Action, Input Data Type, and the matching source field cover the whole request. Output File Name, Async Processing, and Binary Data Output Name all carry working defaults.
Fixes structure, not passwords
The node repairs broken cross-reference tables, malformed object streams, and similar structural damage. It does not remove encryption. Decrypt a password-protected file first if it is also corrupted.
Repair is best-effort, not guaranteed
Recovery depends on how much of the original data survives. Always chain a validation step afterward so your workflow can detect a file that still failed to open and branch to a fallback.
PDF4me node in n8n set to Action Repair PDF Document, Input Data Type Binary Data, Input Binary Field data, Output File Name repaired.pdf, Async toggle on, Binary Data Output Name data

PDF4me Repair PDF Document parameters panel in n8n

Automated Repair (n8n) vs Manual Online Tools

Most PDF repair tools that rank for this term are manual, one-file-at-a-time web uploads. The comparison below is why an automation-platform angle differs from those results.

ApproachTriggerBest fit
Manual web tool (iLovePDF, Adobe, Sejda)Person uploads one file by handA single one-off file you have open in front of you
PDF4me Repair PDF Document in n8nEmail arrival, cloud storage upload, or file-transfer eventRecurring corruption on incoming attachments, archives, or transfers, with no manual step

What Parameters Does Repair PDF Document Need?

Required: Action, Input Data Type, and the field matching that input type. Output File Name, Async Processing, and Binary Data Output Name are all optional with working defaults.

ParameterRequiredWhat it doesExample
ActionRequiredSelects the PDF4me node action to run. Choose Repair PDF Document.Repair PDF Document
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 damaged PDF. Required when Input Data Type is Binary Data. Defaults to data.data
Base64 Document ContentConditionalBase64-encoded content of the damaged PDF. Required when Input Data Type is Base64 String.JVBERi0xLjQK...
File URLConditionalPublicly reachable HTTPS URL to the damaged PDF. Required when Input Data Type is URL.https://example.com/corrupted.pdf
Output File NameOptionalFilename for the repaired PDF output. Defaults to a generated name when left blank. Include the .pdf extension.repaired.pdf
Async ProcessingOptionalRuns repair in the background instead of holding the workflow execution open, useful for large or badly damaged files.true
Binary Data Output NameOptionalName of the binary property the output item exposes. Defaults to data.data

Output Fields

A successful run returns one n8n item carrying the repaired binary PDF.

FieldTypeWhat it contains
Binary (data)BinaryThe repaired PDF with structural errors fixed and readable content restored wherever recoverable, under Binary Data Output Name (default data).
fileNameStringGenerated filename, matching Output File Name.
mimeTypeStringMIME type of the output, always application/pdf.
fileSizeNumberSize of the repaired PDF in bytes.

How Do I Set Up Repair PDF Document in n8n?

  1. Add PDF4me to your n8n workflow and choose the Repair PDF Document 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 damaged PDF field.
  4. Optionally set Output File Name (must end in .pdf).
  5. Enable Async Processing for large or badly damaged files if needed.
  6. Execute the node and route the repaired PDF, exposed under Binary Data Output Name, into the next step.

Typical Setups

Workflow ExamplesCommon n8n workflow patterns using Repair PDF Document.
Email attachment recovery
  1. An email trigger fires when a PDF attachment arrives.
  2. An attempt to process the attachment fails, indicating corruption.
  3. Repair PDF Document runs on the attachment bytes, then processing continues or a validation step confirms success.
Scheduled archive health check
  1. A Schedule Trigger runs weekly or monthly.
  2. Archived PDFs are retrieved and validated for integrity.
  3. Repair PDF Document runs on any file that fails validation, and the archive copy is replaced.
File transfer error recovery
  1. A webhook receives a PDF from an external system.
  2. The file fails an open or validate check.
  3. Repair PDF Document runs with Async Processing on, and processing resumes on success.
Batch repair from a hosted URL list
  1. A Loop Over Items node iterates a list of document URLs from a database export.
  2. Repair PDF Document runs with Input Data Type URL and Async Processing enabled for reliability.
  3. Each repaired file is written to storage with the source record ID as filename.

Practical Tips

Always validate after repair, never assume success
Chain a follow-up open attempt or a metadata check after the node so the workflow can detect a file that is still broken and branch to a fallback path.
Decrypt before you repair, not after
If a file is both password-protected and corrupted, run a PDF4me unlock node first. Repair PDF Document does not remove encryption.
Enable Async for large or badly damaged files
Repair on a heavily corrupted or high-page-count PDF can take longer than a typical synchronous timeout allows.
Keep the original alongside the repaired copy
Store the source file next to the repaired output, at least until the repair is confirmed, so you can compare or retry with a different approach if recovery is incomplete.
Output File Name only affects the returned filename
It has no effect on the repair logic itself, so it does not need to match the original file name.
Notify rather than silently drop a failed repair
When validation after repair still fails, route the workflow to an alert instead of letting the file disappear from the process silently.

Cheat Sheet

FieldValue
ActionRepair PDF Document
Input Data TypeBinary Data
Input Binary Fielddata
Output File Namerepaired.pdf
Async Processingtrue (for large or badly damaged files)
Binary Data Output Namedata
CredentialsPDF4me API credential

Common Questions

What happens if a PDF cannot be repaired?+
The node attempts to fix structural errors and recover readable content, but repair is not guaranteed for every file. Severely damaged PDFs, such as truncated downloads or files with no recoverable cross-reference table, may fail to repair fully or at all. Add a validation step after the node so your workflow can detect a file that still failed to open and branch to a fallback.
Does Repair PDF Document decrypt password-protected files?+
No. Repair PDF Document fixes structural corruption, broken cross-reference tables, and formatting errors defined in the ISO 32000 PDF specification. It does not remove password protection or decrypt an encrypted PDF. If the source file is both corrupted and password-protected, unlock it first with a PDF4me unlock node, then run Repair PDF Document.
Can Repair PDF Document recover content that was deleted before the file was saved?+
No. The node recovers content that exists in the file but is unreadable due to structural corruption, such as a broken object table or malformed page tree. It cannot reconstruct content that was never saved to the file or was overwritten.
Do I need to enable Async for large or badly damaged PDFs?+
Async Processing lets the node run repair in the background instead of holding the workflow execution open, which helps with large files or when repair takes longer than a typical synchronous timeout allows.
How do I fix a PDF that says "the file is damaged and could not be repaired"?+
That message usually comes from a desktop PDF reader refusing to open a structurally broken file. Route the same file through the PDF4me Repair PDF Document node instead. It targets exactly this class of error, broken cross-reference tables, malformed object streams, and truncated trailers, and returns a rebuilt PDF the reader can open.

Same Task on Other Platforms

Get Help