PDF Splitting Tips

2026-04-28·5 min read·Document

PDF Splitting Use Cases

PDF splitting divides one PDF file into multiple files. Common use cases include: splitting large documents by chapter for distribution, extracting specific pages for approval, splitting multi-page scanned documents into single pages, and separating different parts of sensitive documents for different personnel. Unlike PDF merging, splitting operations need to maintain format integrity for each part.

The difficulty of PDF splitting lies in handling cross-page elements such as cross-page tables, annotations, and bookmarks. Simple page-by-page splitting usually works fine, but content-based splitting requires more intelligent tools. Additionally, split files may need to regenerate cross-reference tables and file structures to ensure each part is a complete PDF file.

Command-Line Splitting Methods

# Using pdftk to split PDFs

# Split by page (one file per page)
pdftk input.pdf burst output page_%02d.pdf

# Extract specific pages
pdftk input.pdf cat 1-5 output first_5_pages.pdf
pdftk input.pdf cat 6-10 output pages_6_to_10.pdf
pdftk input.pdf cat 1-3 10-15 output selected_pages.pdf

# Using Ghostscript to split
gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dFirstPage=1 -dLastPage=5 \
   -sOutputFile=output.pdf input.pdf

Programming Implementation

// Node.js using pdf-lib to split by page
const { PDFDocument } = require('pdf-lib');
const fs = require('fs');

async function splitPDFByPages(inputFile, outputDir) {
  const pdfBytes = fs.readFileSync(inputFile);
  const pdf = await PDFDocument.load(pdfBytes);
  const pageCount = pdf.getPageCount();

  for (let i = 0; i < pageCount; i++) {
    const newPdf = await PDFDocument.create();
    const [copiedPage] = await newPdf.copyPages(pdf, [i]);
    newPdf.addPage(copiedPage);

    const newPdfBytes = await newPdf.save();
    const outputFile = `${outputDir}/page_${String(i + 1).padStart(3, '0')}.pdf`;
    fs.writeFileSync(outputFile, newPdfBytes);
  }
}

// Split by range
async function splitPDFByRange(inputFile, ranges) {
  const pdfBytes = fs.readFileSync(inputFile);
  const pdf = await PDFDocument.load(pdfBytes);

  for (const [start, end, filename] of ranges) {
    const newPdf = await PDFDocument.create();
    const indices = Array.from({ length: end - start + 1 }, (_, i) => start - 1 + i);
    const copiedPages = await newPdf.copyPages(pdf, indices);
    copiedPages.forEach(page => newPdf.addPage(page));

    const newPdfBytes = await newPdf.save();
    fs.writeFileSync(filename, newPdfBytes);
  }
}

Recommended Tools

pdftk supports multiple splitting methods and is a comprehensive PDF tool. pdf-lib provides flexible programming interfaces. Sejda is an online PDF tool supporting intelligent splitting. PDFsam is an open-source PDF splitting and merging tool.