Skip to main content

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

AttributeTypeRequiredDescription
documentsarrayYesArray of documents to merge
documents[].fileUrlstringNoURL of the PDF file to merge
documents[].documentStreambinaryNoStream of the PDF document to merge
documents[].pageNumbersnumber[]NoArray of page numbers to include from this document. If omitted, all pages will be merged

Output Attributes

AttributeTypeDescription
documentStreamStreamThe 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"