Delete Pages from PDF Online - Remove Pages from PDF

Delete Pages from PDF Online - Remove Pages Securely and Free | ImgConvertPro
No file loaded.
Use commas (,) for individual pages and hyphens (-) for ranges.

Load a PDF file above to begin removing unwanted pages.

Delete Pages from PDF Online - Remove Pages from Document

Remove single pages, multiple pages, or entire ranges from your PDF document easily and securely.

Delete Pages from PDF: Your Free Online PDF Page Remover

Need to quickly **remove pages from a PDF** document? The ImgConvertPro **Delete Pages from PDF** tool offers a simple, secure, and highly effective solution. Whether you’re dealing with unnecessary cover pages, blank sheets, or confidential sections that need to be excluded from the final document, our tool gives you surgical precision to clean up your file. Unlike complicated desktop software, our online tool requires no installation and is accessible from any modern web browser or device, making your document editing workflow smooth and instantaneous.

Security is paramount when handling sensitive documents. That's why this tool operates using **client-side processing**, powered by advanced JavaScript libraries like `pdf-lib`. This means that **your PDF file never leaves your computer**. The entire deletion process—from loading the file to removing the specified pages and generating the new PDF—happens locally in your browser. This commitment to privacy ensures that your confidential information remains completely secure throughout the entire process, providing peace of mind as you edit and clean your documents.

Using the tool is straightforward. Simply **upload your PDF**, and then specify the page numbers you wish to delete in the input box. You can define single pages (e.g., `5`), comma-separated pages (e.g., `1, 10, 15`), or ranges (e.g., `2-7`). Once you have entered the list of pages, click the "Delete Pages & Download PDF" button. The tool will instantly generate a new, clean PDF containing only the pages you want to keep. The resulting file maintains the highest quality and integrity of the original pages, ensuring your final document is ready for sharing or printing.

Stop wasting time with bloated PDF editors. ImgConvertPro is dedicated to providing efficient, free, and secure utilities for document management. Use the **PDF Page Remover** tool today to finalize reports, trim down large files, or prepare specific sections of a document for distribution. Clean up your PDF files now and enjoy the speed and simplicity of our specialized online tool!

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Delete Pages from PDF Online - Remove Pages Securely and Free | ImgConvertPro</title> <meta name="description" content="Free tool to delete unwanted pages from your PDF documents. Secure, fast, and no file uploads required. Easily specify page numbers to remove."> <meta name="keywords" content="delete pages from pdf, remove pages from pdf, online pdf page remover, free pdf editor, pdf page delete tool, remove pages from document"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> <script src="https://cdnjs.cloudflare.com/ajax/libs/pdf-lib/1.17.1/pdf-lib.min.js"></script> <style> /* Base Styling */ .img-convert-pro-tool { width: 100%; max-width: 1200px; margin: 0 auto; padding: 20px; box-sizing: border-box; font-family: 'Inter', sans-serif; color: #2c3e50; } /* Tool Controls */ .tool-controls { display: flex; flex-direction: column; gap: 15px; align-items: center; padding: 25px; border: 2px dashed #f39c12; /* Warning/Deletion related theme color */ border-radius: 10px; background-color: #fcf8e3; /* Light yellow background */ margin-bottom: 25px; } #fileInput { display: none; } .custom-file-upload { display: inline-block; padding: 14px 30px; cursor: pointer; background-color: #3498db; color: white; border-radius: 6px; font-weight: 600; text-transform: uppercase; transition: background-color 0.3s, transform 0.1s; } .custom-file-upload:hover { background-color: #2980b9; transform: translateY(-1px); } #deleteBtn { padding: 14px 35px; background-color: #e74c3c; /* Red for Delete Action */ color: white; border: none; border-radius: 6px; cursor: pointer; font-size: 1.1em; font-weight: 700; transition: background-color 0.3s; box-shadow: 0 4px 6px rgba(0,0,0,0.1); width: 100%; max-width: 300px; } #deleteBtn:hover:not(:disabled) { background-color: #c0392b; } #deleteBtn:disabled { background-color: #bdc3c7; cursor: not-allowed; color: #6c7a89; box-shadow: none; } /* Input specific section */ .page-input-group { width: 100%; max-width: 600px; display: flex; flex-direction: column; gap: 10px; align-items: center; } #pagesToDelete { width: 100%; padding: 12px; border: 1px solid #ccc; border-radius: 4px; font-size: 1em; text-align: center; } .input-hint { font-size: 0.9em; color: #7f8c8d; text-align: center; } /* Result Area */ #resultArea { padding: 30px; border: 1px solid #ddd; border-radius: 10px; min-height: 140px; text-align: center; display: flex; justify-content: center; align-items: center; flex-direction: column; gap: 20px; background-color: #fff; box-shadow: 0 2px 4px rgba(0,0,0,0.05); margin-bottom: 30px; } .download-link { display: inline-block; padding: 12px 28px; background-color: #2ecc71; color: white; font-weight: 600; border-radius: 6px; text-decoration: none; text-transform: uppercase; transition: background-color 0.3s; margin: 10px; border: none; cursor: pointer; font-size: 1em; } .download-link:hover { background-color: #27ae60; } /* Progress & Status */ .progress-container { width: 100%; background-color: #f1f1f1; border-radius: 5px; margin: 15px 0; display: none; } .progress-bar { width: 0%; height: 10px; background: linear-gradient(135deg, #e74c3c 0%, #f39c12 100%); border-radius: 5px; transition: width 0.3s ease; } .status-error { background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; padding: 15px; margin: 10px 0; border-radius: 5px; } .status-info { background-color: #d9edf7; color: #31708f; border: 1px solid #bce8f1; padding: 15px; margin: 10px 0; border-radius: 5px; } /* Tool Info Section (H1) */ .tool-info { text-align: center; margin: 0 0 40px 0; } .tool-info h1 { font-size: 2.4em; color: #34495e; margin-bottom: 12px; } .tool-info p { font-size: 1.15em; color: #7f8c8d; } /* File Display */ #currentFileDisplay { margin-top: 10px; font-size: 1.1em; font-weight: 600; padding: 8px 15px; background: #ecf0f1; border-radius: 4px; display: none; max-width: 600px; width: 100%; text-align: center; } /* SEO Content Styling */ .seo-content { margin-top: 30px; padding-top: 35px; border-top: 1px solid #ecf0f1; text-align: left; line-height: 1.8; } .seo-content h2 { font-size: 2em; margin-bottom: 25px; color: #f39c12; border-bottom: 2px solid #f39c12; padding-bottom: 8px; } .seo-content p { margin-bottom: 25px; font-size: 1.05em; color: #555; } .seo-metadata-box { margin-top: 40px; padding: 18px; background-color: #fcf8e3; border-left: 5px solid #f39c12; border-radius: 6px; } /* Responsive adjustments */ @media (max-width: 600px) { .custom-file-upload, #deleteBtn { width: 100%; text-align: center; padding: 12px; } } </style> </head> <body> <div class="img-convert-pro-tool"> <div class="tool-controls"> <input type="file" id="fileInput" accept=".pdf"> <label for="fileInput" class="custom-file-upload"> <i class="fa-solid fa-upload"></i> Select PDF File </label> <div id="currentFileDisplay"> <i class="fa-solid fa-file-pdf"></i> No file loaded. </div> <div class="page-input-group"> <input type="text" id="pagesToDelete" placeholder="Enter page numbers to delete (e.g., 2, 5-8, 12)"> <div class="input-hint">Use commas (,) for individual pages and hyphens (-) for ranges.</div> </div> <div class="progress-container" id="progressContainer"> <div class="progress-bar" id="progressBar"></div> </div> <button id="deleteBtn" disabled> <i class="fa-solid fa-trash-can"></i> Delete Pages & Download PDF </button> </div> <div id="resultArea"> <p class="status-info">Load a PDF file above to begin removing unwanted pages.</p> </div> <div class="tool-info"> <h1><i class="fa-solid fa-file-excel"></i> Delete Pages from PDF Online - Remove Pages from Document</h1> <p>Remove single pages, multiple pages, or entire ranges from your PDF document easily and securely.</p> </div> <div class="seo-content"> <h2>Delete Pages from PDF: Your Free Online PDF Page Remover</h2> <p>Need to quickly **remove pages from a PDF** document? The ImgConvertPro **Delete Pages from PDF** tool offers a simple, secure, and highly effective solution. Whether you’re dealing with unnecessary cover pages, blank sheets, or confidential sections that need to be excluded from the final document, our tool gives you surgical precision to clean up your file. Unlike complicated desktop software, our online tool requires no installation and is accessible from any modern web browser or device, making your document editing workflow smooth and instantaneous.</p> <p>Security is paramount when handling sensitive documents. That's why this tool operates using **client-side processing**, powered by advanced JavaScript libraries like `pdf-lib`. This means that **your PDF file never leaves your computer**. The entire deletion process—from loading the file to removing the specified pages and generating the new PDF—happens locally in your browser. This commitment to privacy ensures that your confidential information remains completely secure throughout the entire process, providing peace of mind as you edit and clean your documents.</p> <p>Using the tool is straightforward. Simply **upload your PDF**, and then specify the page numbers you wish to delete in the input box. You can define single pages (e.g., `5`), comma-separated pages (e.g., `1, 10, 15`), or ranges (e.g., `2-7`). Once you have entered the list of pages, click the "Delete Pages & Download PDF" button. The tool will instantly generate a new, clean PDF containing only the pages you want to keep. The resulting file maintains the highest quality and integrity of the original pages, ensuring your final document is ready for sharing or printing.</p> <p>Stop wasting time with bloated PDF editors. ImgConvertPro is dedicated to providing efficient, free, and secure utilities for document management. Use the **PDF Page Remover** tool today to finalize reports, trim down large files, or prepare specific sections of a document for distribution. Clean up your PDF files now and enjoy the speed and simplicity of our specialized online tool!</p> <div class="seo-metadata-box"> <p><strong>SEO Meta Title:</strong> Delete Pages from PDF Online - Remove Pages Securely and Free</p> <p><strong>SEO Meta Description:</strong> Free tool to delete unwanted pages from your PDF documents. Secure, fast, and no file uploads required. Easily specify page numbers to remove.</p> <p><strong>SEO Meta Keywords:</strong> delete pages from pdf, remove pages from pdf, online pdf page remover, free pdf editor, pdf page delete tool, remove pages from document, secure pdf edit, remove specific pages</p> </div> </div> </div> <script> const fileInput = document.getElementById('fileInput'); const pagesToDeleteInput = document.getElementById('pagesToDelete'); const deleteBtn = document.getElementById('deleteBtn'); const resultArea = document.getElementById('resultArea'); const progressContainer = document.getElementById('progressContainer'); const progressBar = document.getElementById('progressBar'); const currentFileDisplay = document.getElementById('currentFileDisplay'); let currentPdfFile = null; let pdfDoc = null; let totalPages = 0; // --- Utility Functions --- function formatFileSize(bytes) { if (bytes === 0) return '0 Bytes'; const k = 1024; const sizes = ['Bytes', 'KB', 'MB', 'GB']; const i = Math.floor(Math.log(bytes) / Math.log(k)); return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i]; } function showStatus(message, type = 'info') { resultArea.innerHTML = `<p class="status-message status-${type}"><i class="fa-solid fa-info-circle"></i> ${message}</p>`; } function showError(message) { showStatus(message, 'error'); deleteBtn.disabled = true; progressContainer.style.display = 'none'; } function resetTool() { currentPdfFile = null; pdfDoc = null; totalPages = 0; fileInput.value = ''; pagesToDeleteInput.value = ''; deleteBtn.disabled = true; currentFileDisplay.style.display = 'none'; currentFileDisplay.innerHTML = '<i class="fa-solid fa-file-pdf"></i> No file loaded.'; showStatus('Load a PDF file above to begin removing unwanted pages.', 'info'); } // --- PDF Processing Logic --- fileInput.addEventListener('change', async (event) => { const file = event.target.files[0]; if (!file || file.type !== 'application/pdf') { resetTool(); if (file) showError('Please select a valid PDF file.'); return; } currentPdfFile = file; showStatus('Loading PDF...', 'info'); progressContainer.style.display = 'block'; progressBar.style.width = '10%'; deleteBtn.disabled = true; try { const arrayBuffer = await readFileAsArrayBuffer(file); const { PDFDocument } = window.PDFLib; pdfDoc = await PDFDocument.load(arrayBuffer); totalPages = pdfDoc.getPageCount(); progressBar.style.width = '100%'; currentFileDisplay.style.display = 'block'; currentFileDisplay.innerHTML = `<i class="fa-solid fa-file-pdf"></i> **${file.name}** | Total Pages: **${totalPages}**`; showStatus(`PDF loaded successfully. Enter pages (1 to ${totalPages}) to delete.`, 'info'); deleteBtn.disabled = false; pagesToDeleteInput.focus(); } catch (error) { console.error('PDF Load Error:', error); showError('Could not load PDF file. It might be corrupted or protected.'); resetTool(); } finally { progressContainer.style.display = 'none'; } }); function readFileAsArrayBuffer(file) { return new Promise((resolve, reject) => { const reader = new FileReader(); reader.onload = () => resolve(reader.result); reader.onerror = reject; reader.readAsArrayBuffer(file); }); } // --- Page Number Parser --- function parsePagesToDelete(input, maxPages) { const parts = input.split(',').map(s => s.trim()).filter(s => s.length > 0); const indicesToRemove = new Set(); let hasError = false; for (const part of parts) { if (part.includes('-')) { // Handle range (e.g., 5-10) const [startStr, endStr] = part.split('-').map(s => s.trim()); const start = parseInt(startStr); const end = parseInt(endStr); if (isNaN(start) || isNaN(end) || start < 1 || end < 1 || start > maxPages || end > maxPages || start > end) { hasError = true; break; } for (let i = start; i <= end; i++) { indicesToRemove.add(i - 1); // PDF-lib uses 0-based index } } else { // Handle single page (e.g., 3) const pageNum = parseInt(part); if (isNaN(pageNum) || pageNum < 1 || pageNum > maxPages) { hasError = true; break; } indicesToRemove.add(pageNum - 1); // PDF-lib uses 0-based index } } if (hasError) return { error: true, indices: null }; // Sort indices in descending order so that removal doesn't affect subsequent indices const sortedIndices = Array.from(indicesToRemove).sort((a, b) => b - a); return { error: false, indices: sortedIndices }; } // --- Delete Button Action --- deleteBtn.addEventListener('click', async () => { if (!pdfDoc || !currentPdfFile) { showError('Please load a PDF file first.'); return; } const pageInput = pagesToDeleteInput.value; if (!pageInput) { showError('Please enter the page numbers you wish to delete.'); return; } const { error, indices } = parsePagesToDelete(pageInput, totalPages); if (error) { showError(`Invalid page numbers or range detected. Please check your input (1 to ${totalPages}).`); return; } if (indices.length === 0) { showError('No valid pages selected for deletion.'); return; } showStatus(`Deleting ${indices.length} pages...`, 'info'); deleteBtn.disabled = true; progressContainer.style.display = 'block'; progressBar.style.width = '30%'; try { const pagesDeletedCount = indices.length; // Remove pages (Indices must be in descending order) indices.forEach(index => { pdfDoc.removePage(index); }); progressBar.style.width = '80%'; // Save the modified PDF const modifiedPdfBytes = await pdfDoc.save(); progressBar.style.width = '100%'; const newTotalPages = pdfDoc.getPageCount(); // Create download section createDownloadSection(modifiedPdfBytes, pagesDeletedCount, newTotalPages); // Update internal state totalPages = newTotalPages; setTimeout(() => { progressContainer.style.display = 'none'; deleteBtn.disabled = false; }, 500); } catch (error) { console.error('Deletion error:', error); showError('An unexpected error occurred during page deletion. The PDF may be corrupted.'); } }); // --- Download Section --- function createDownloadSection(pdfBytes, deletedCount, newTotalPages) { const blob = new Blob([pdfBytes], { type: 'application/pdf' }); const url = URL.createObjectURL(blob); resultArea.innerHTML = ` <div style="background: #e6f7e9; padding: 20px; border-radius: 8px; width: 100%; max-width: 450px; border: 1px solid #2ecc71;"> <h3><i class="fa-solid fa-circle-check" style="color: #2ecc71;"></i> Pages Deleted Successfully!</h3> <p style="color: #555;"> <span style="font-weight: bold; color: #e74c3c;">${deletedCount} page(s)</span> removed.<br> New PDF has <span style="font-weight: bold; color: #3498db;">${newTotalPages} page(s)</span>. </p> <p><strong>File Size:</strong> ${formatFileSize(blob.size)}</p> <button class="download-link" onclick="downloadModifiedPDF('${url}')"> <i class="fa-solid fa-download"></i> Download Cleaned PDF </button> <button class="custom-file-upload" onclick="resetTool()" style="background-color: #555; margin-top: 10px;"> <i class="fa-solid fa-sync"></i> Start New Deletion </button> </div> `; } window.downloadModifiedPDF = function(url) { const link = document.createElement('a'); link.href = url; link.download = `ImgConvertPro-cleaned-${currentPdfFile.name}`; document.body.appendChild(link); link.click(); document.body.removeChild(link); setTimeout(() => URL.revokeObjectURL(url), 100); } // Initial setup resetTool(); </script> </body> </html>