Skip to content
ComPDF
New Release

Open-Source PDF SDK & AI Document Processing

Get the full self-hosted SDK and AI document processing on GitHub. One-click deploy to quickly build your document workflows.

Insert Pages

Insert a blank page or pages from other PDFs into the target document.

Insert Blank Pages

This example shows how to insert a blank page:

javascript
// Insert after the first page.
const pageIndex = 1;
const width = 612;
const height = 792;

docViewer.insertBlankPage(pageIndex, width, height);

Insert Pages from other PDFs

This example shows how to insert pages from other PDFs:

javascript
const file = {...}; // File Object.
const pageIndexToInsert = 1;
const pagesToInsert = [1, '3-5']; // Insert the range of PDF pages.

docViewer.insertPages(file, pageIndexToInsert, pagesToInsert);