All templates
PDFBeginner
Merge Two PDFs
Robomotion•Updated 9 months ago

Overview
Joins two PDF files into a single output document — the minimal merge recipe.
Merge Two PDFs
PDF manipulation is an ideal candidate for automation, as many scenarios, such as merging reports, require strictly standardized steps. Robomotion provides a series of PDF nodes to automate these tasks and handle PDF files efficiently.
What Merge Two PDFs can do
Download Fixturessubflow thenBuild Defaults(Core.Programming.Function) setsmsg.default_first,msg.default_second,msg.default_destunder$Home$/templates/pdf-automation/merge-two-pdfs/fixtures.- Three
Core.Dialog.InputBoxprompts titledMerge two PDFs into one.collectmsg.first_doc,msg.second_doc, andmsg.destination_folderusing the defaults above. Validate Inputs(Core.Programming.Function,outputs: 2) — short-circuits toCore.Flow.Stopif any path is empty; otherwise buildsmsg.pdf_paths = [msg.second_doc, msg.first_doc]and seedsmsg.candidate_pathas<dest>\MergedFile.pdf.Core.FileSystem.Createensures the destination directory exists, then aCore.Flow.Label/Core.FileSystem.PathExistsloop incrementsmsg.suffix_idxuntilmsg.candidate_pathis free and stores it asmsg.merged_path.Robomotion.PDFProcessor.Core.Mergewritesmsg.pdf_pathstomsg.merged_path, thenCore.Dialog.MessageBoxtitledDone!shows the final path viamsg.dialog_text.
Behind the scenes
- The merge node receives a real array (
msg.pdf_paths), not a delimited string —Robomotion.PDFProcessor.Core.Mergeexpects an array of paths. - Note the order swap:
msg.pdf_pathslists the second document first, then the first. This preserves the reversed-list convention from the original tutorial. - The suffix loop guarantees we never overwrite an existing
MergedFile.pdf; subsequent runs land onMergedFile_2.pdf,MergedFile_3.pdf, etc. - The success dialog surfaces the full merged-file path (
msg.merged_path), so the user can locate the exact output even when the suffix loop renamed it.
More pdf templates
See all 9 →- Create PDF from Selected PagesPulls a chosen range of pages from a source PDF and writes them to a new document. Useful for trimming or sharing parts of a report.
- Extract Tables from PDFLocates tables inside a PDF and extracts their rows into structured data. A drop-in stage in any OCR-adjacent pipeline.
- Get Images from PDFExtracts every embedded image from a PDF file into a target directory. Useful for downstream OCR or asset recovery.
- Get Number of Pages in a PDFReports the page count of a PDF file as a single number. A small utility that feeds splitters, paginators, and dashboards.
- Merge PDFsCombines every PDF in a folder into one consolidated document using a reusable merge subflow.
- Split PDF by HalfCalculates a midpoint and splits a PDF into two evenly-sized halves. Demonstrates arithmetic on page counts feeding a splitter.