PDF Document Tasks
PDF Document tasks are used to perform operations on PDF documents.
PDF Merge Task
task: "PdfDocument/Merge@1"
name: mergePdfs
inputs:
documents:
- fileUrl: "https://example.com/document1.pdf"
pageNumbers: [1, 3, 5] # Optional - merges only specified pages
- documentStream: !!binary | # New input stream option
<base64-encoded-stream>
pageNumbers: [2, 4] # Optional - merges only specified pages
outputs:
- name: documentStream
mapping: "documentStream"
Attributes
Input Attributes
Attribute | Type | Required | Description |
---|---|---|---|
documents | array | Yes | Array of documents to merge |
documents[].fileUrl | string | No | URL of the PDF file to merge |
documents[].documentStream | binary | No | Stream of the PDF document to merge |
documents[].pageNumbers | number[] | No | Array of page numbers to include from this document. If omitted, all pages will be merged |
Output Attributes
Attribute | Type | Description |
---|---|---|
documentStream | Stream | The resulting merged PDF document as a binary stream |
Examples
Merge Complete Documents
task: "PdfDocument/Merge@1"
name: mergeFullDocuments
inputs:
documents:
- fileUrl: "https://storage.example.com/invoice.pdf"
- documentStream: !!binary |
<base64-encoded-stream>
outputs:
- name: mergedDocument
mapping: "documentStream"
Merge Specific Pages
task: "PdfDocument/Merge@1"
name: mergeSelectedPages
inputs:
documents:
- fileUrl: "https://storage.example.com/contract.pdf"
pageNumbers: [1, 2, 5] # Only merge pages 1, 2, and 5
- documentStream: !!binary |
<base64-encoded-stream>
pageNumbers: [1] # Only merge first page
outputs:
- name: mergedDocument
mapping: "documentStream"
Remove Pages from Single Document using Merge Task
task: "PdfDocument/Merge@1"
name: removePagesFromSingleDocument
inputs:
documents:
- fileUrl: "https://storage.example.com/document.pdf"
pageNumbers: [1, 3] # Remove page #2
outputs:
- name: documentStream
mapping: "documentStream"