Stirling PDF icon

Stirling PDF

Merged API: Stirling PDF - Processing API + Stirling PDF - Management API + Stirling PDF - System API

Actions260

General → Merge Multiple Pages Into One

AI-generated

Summary

Merge multiple pages of a PDF into a single page layout according to specified arrangement and sizing options.

Inputs

  • fileInputBinaryProperty — Binary property name containing PDF file data to process (defaults to 'data').
  • fileId — Identifier of a previously processed file on the server to reuse for merging.
  • mode (required) — Determines layout mode: 'DEFAULT' uses preset pages per sheet; 'CUSTOM' requires explicit row and column counts.
  • pagesPerSheet — Number of pages to fit on each output sheet (used in DEFAULT mode). Options: 2, 4, 9, 16.
  • arrangement — Page placement order on the output sheet: by rows or by columns.
  • readingDirection — Page order direction: left-to-right (LTR) or right-to-left (RTL).
  • rows — Number of rows in the output page layout (used in CUSTOM mode).
  • cols — Number of columns in the output page layout (used in CUSTOM mode).
  • orientation — Orientation of output PDF pages: portrait or landscape.
  • innerMargin — Margin around each merged page (points).
  • topMargin — Top margin of merged pages in output (points).
  • bottomMargin — Bottom margin of merged pages in output (points).
  • leftMargin — Left margin of merged pages in output (points).
  • rightMargin — Right margin of merged pages in output (points).
  • borderWidth — Width of the border around each merged page (points).
  • addBorder — Whether to add a border around each page.

Output shape

a single PDF file with multiple original pages merged onto each page per the layout configuration

Input PDF can be supplied as binary data or by referencing a server-side file ID. Layout is configurable with either a preset number of pages per sheet (DEFAULT mode) or explicit rows and columns (CUSTOM mode). Margins, orientation, reading direction, and optional borders can be set.

Examples

Example 1: Merging an input PDF binary with 4 pages per sheet using default mode, arranged by rows with LTR reading direction, no borders.

Set 'fileInputBinaryProperty' to input field name; 'mode' to 'DEFAULT'; 'pagesPerSheet' to 4; 'arrangement' to 'BY_ROWS'; 'readingDirection' to 'LTR'; 'addBorder' to false.

Example 2: Merging a server-stored PDF file by specifying a file ID with a custom layout of 2 rows and 3 columns, landscape orientation, with borders of 2 points.

Set 'fileId' to target file ID; 'mode' to 'CUSTOM'; 'rows' to 2; 'cols' to 3; 'orientation' to 'LANDSCAPE'; 'addBorder' to true; 'borderWidth' to 2.

Links

Discussion