PDF Page Remover: How to Delete Pages from a PDF
Every PDF user has encountered the situation: a document contains pages you don't need — blank scanned sheets, covers, disclaimers, or outdated content. Instead of printing and reconstructing the document, you can delete those pages directly using a PDF page remover tool. This guide shows you how to remove pages from a PDF online, programmatically, and on the command line.
Why Remove Pages from a PDF?
- Clean up scanned documents — Remove blank or duplicate pages from scans
- Reduce file size — Deleting unnecessary pages shrinks the document
- Prepare submissions — Remove cover sheets or disclaimers before sharing
- Extract specific content — Keep only the pages that are relevant to your reader
- Remove watermarks or headers — Sometimes it's easier to delete the page than clean it
- Reorganize documents — Delete old versions before inserting updated content
How to Choose Which Pages to Delete
Before using a page remover, decide which pages to keep rather than which to delete. This approach reduces errors:
- Note the total page count — Check how many pages the PDF has
- Identify pages to keep — Write down the ranges you need (e.g., 3-10, 12, 15-20)
- Invert to find pages to delete — Pages 1-2, 11, 13-14, 21+ would be deleted
- Enter the keep ranges — Some tools let you specify pages to keep instead of delete
Page Number Formats
| Format | Example | Meaning |
|---|---|---|
| Single page | 5 |
Delete page 5 |
| Range | 3-7 |
Delete pages 3 through 7 |
| Multiple | 1, 5, 9 |
Delete pages 1, 5, and 9 |
| Mixed | 1-3, 7, 9-11 |
Delete pages 1,2,3,7,9,10,11 |
| All except | !4-8 |
Delete everything except pages 4 through 8 |
How the PDF Page Remover Tool Works
The PDF Page Remover tool on Help2Code processes your file entirely in your browser using PDF.js. No data is uploaded to any server — your document stays on your device.
Step-by-Step Instructions
- Open the PDF Page Remover tool in your browser
- Upload your PDF — drag and drop or click to browse
- Preview the document — all pages are displayed as thumbnails
- Select pages to remove — either click thumbnails or enter page numbers/ranges
- Download the result — the cleaned PDF is generated locally and downloaded
Code Examples
JavaScript: Remove Pages Using pdf-lib
const { PDFDocument } = require('pdf-lib');
async function removePages(sourceBytes, pagesToKeep) {
const sourceDoc = await PDFDocument.load(sourceBytes);
const newDoc = await PDFDocument.create();
const copiedPages = await newDoc.copyPages(
sourceDoc,
pagesToKeep
);
copiedPages.forEach(page => newDoc.addPage(page));
return await newDoc.save();
}
// Usage: keep pages 1-3 and 5 (0-indexed: 0,1,2,4)
const pagesToKeep = [0, 1, 2, 4];
removePages(pdfBuffer, pagesToKeep).then(result => {
// result is a Uint8Array of the new PDF
});
Python: Delete Pages with PyMuPDF
import fitz # PyMuPDF
def remove_pages(input_pdf: str, output_pdf: str, pages_to_keep: list[int]):
src = fitz.open(input_pdf)
dst = fitz.open()
for page_num in pages_to_keep:
dst.insert_pdf(src, from_page=page_num, to_page=page_num)
dst.save(output_pdf)
dst.close()
src.close()
remove_pages('input.pdf', 'output.pdf', [0, 1, 2, 4])
# Keeps pages 1, 2, 3, 5 (0-indexed input)
PHP: Remove Pages with FPDI
use setasign\Fpdi\Fpdi;
function removePdfPages(string $inputFile, string $outputFile, array $pagesToKeep): void {
$pdf = new Fpdi();
$pageCount = $pdf->setSourceFile($inputFile);
foreach ($pagesToKeep as $page) {
$templateId = $pdf->importPage($page);
$size = $pdf->getTemplateSize($templateId);
$pdf->addPage($size['orientation'] === 'L' ? 'L' : 'P', [$size['width'], $size['height']]);
$pdf->useTemplate($templateId);
}
$pdf->Output($outputFile, 'F');
}
// Keep pages 1, 2, 3, 5 (1-indexed)
removePdfPages('input.pdf', 'output.pdf', [1, 2, 3, 5]);
Command Line: Using pdftk or qpdf
# Using pdftk: keep pages 1-3 and 5
pdftk input.pdf cat 1-3 5 output output.pdf
# Using qpdf: same result
qpdf --pages input.pdf 1-3,5 -- input.pdf output.pdf
# Remove specific pages by selecting everything else
pdftk input.pdf cat 1-2 4-end output output.pdf
# This removes page 3
Common Use Cases
Remove Blank Pages from Scanned Documents
Scanned PDFs often include blank separator pages. To remove them:
- Upload the scanned PDF to the page remover
- Preview all pages in thumbnail view
- Identify blank pages (they appear as empty thumbnails)
- Delete them by entering their page numbers
- Download the cleaned document
Remove Cover and Disclaimer Pages
Many official documents have a cover page followed by a blank disclaimer page. To remove them:
# Using pdftk: start from page 3
pdftk document.pdf cat 3-end output clean.pdf
Extract a Subset for Email
When you only need to send a few pages of a large document:
# Extract only pages 5-10
pdftk large-document.pdf cat 5-10 output excerpt.pdf
Privacy and Security Considerations
The most secure approach to editing PDFs is client-side processing. When you use an online tool that requires upload, your document is transferred to a server where it may be stored temporarily or permanently. The PDF Page Remover tool processes everything in your browser — your file never touches any server.
| Processing Type | Data Transfer | Security | Convenience |
|---|---|---|---|
| Client-side (browser) | None | Highest | Requires modern browser |
| Server-side upload | Yes | Lower | Works on any device |
| Desktop software | None | High | Requires installation |
| Command line | None | High | Requires technical skill |
Best Practices
- Always keep a backup — Work on a copy, not the original
- Verify page order — Count pages before and after to confirm accuracy
- Use descriptive filenames — Name the output something meaningful
- Check for metadata — PDF metadata (author, title) persists across edits
- Test the result — Open the output file to verify the correct pages remain
- Delete sensitive pages — Not delete; ensure they are removed from the file, not just hidden
Troubleshooting
Problem: The output file is larger than the input Solution: Page removal doesn't compress images. Use a PDF compressor after removing pages.
Problem: The tool shows an error loading the PDF Solution: The file may be corrupted or password-protected. Try opening it in a PDF reader first.
Problem: Page numbers seem off Solution: Some tools count from 0 (programmatic) while others count from 1 (user-facing). Verify the convention.
Problem: Removed pages are still visible in some viewers Solution: Make sure you're downloading the processed file, not the original. Clear your browser cache.
Conclusion
Removing pages from a PDF is a simple but essential document management skill. Whether you're cleaning up scans, extracting excerpts, or preparing documents for submission, the PDF Page Remover tool lets you do it instantly in your browser with complete privacy. Combine it with the programmatic approaches above for automated batch processing of multiple documents.