Back
Advanced PDF Unlocker | Oxford TRG
Advanced PDF Unlocker
Unlock protected PDF files with password
Oxford TRG
Upload a protected PDF, enter the password, apply unlock, and download the unsecured version. Note: Requires the correct password to unlock protections.

PDF Unlocker

Drag & Drop your PDF here

or click to browse files

Password

Advanced Options

Actions

Preview & Export

Unlock info

Unlocked PDF will appear here

Original Size: N/A
Unlocked Size: N/A

© Oxford TRG | Advanced PDF Unlocker Tool

'; } } // Apply unlock async function applyUnlock() { if (!currentPdfBytes) { showNotification('Please upload a PDF first', 'warning'); return; } const password = passwordInput.value; if (!password) { showNotification('Please enter a password', 'warning'); return; } showNotification('Unlocking PDF...', 'info'); try { const pdfDoc = await PDFLib.PDFDocument.load(currentPdfBytes, { password }); if (removeMetadata.checked) { pdfDoc.removeMetadata(); } if (flattenForms.checked) { pdfDoc.flatten(); } const unlockedBytes = await pdfDoc.save(); unlockedBlob = new Blob([unlockedBytes], {type: 'application/pdf'}); unlockedSize.textContent = `Unlocked Size: ${(unlockedBlob.size / 1024 / 1024).toFixed(2)} MB`; showNotification('PDF unlocked successfully!', 'success'); // Render unlocked preview const loadingTask = pdfjsLib.getDocument(unlockedBytes); const pdf = await loadingTask.promise; const page = await pdf.getPage(1); const viewport = page.getViewport({scale: 0.5}); const canvas = document.createElement('canvas'); canvas.width = viewport.width; canvas.height = viewport.height; await page.render({canvasContext: canvas.getContext('2d'), viewport}).promise; finalPreview.innerHTML = ''; finalPreview.appendChild(canvas); finalPreview.appendChild(document.createElement('div')).className = 'size-info'; finalPreview.appendChild(document.createElement('div')).className = 'size-info'; finalPreview.querySelectorAll('.size-info')[0].textContent = originalSize.textContent; finalPreview.querySelectorAll('.size-info')[1].textContent = unlockedSize.textContent; } catch (error) { showNotification('Error unlocking PDF: ' + error.message, 'warning'); } } // Reset unlocker settings function resetUnlocker() { passwordInput.value = ''; removeMetadata.checked = true; flattenForms.checked = true; showNotification('Settings reset', 'info'); } // Clear all function clearAll() { currentPdfBytes = null; unlockedBlob = null; pdfUpload.value = ''; unlockerArea.innerHTML = `

Drag & Drop your PDF here

or click to browse files

`; originalSize.textContent = 'Original Size: N/A'; unlockedSize.textContent = 'Unlocked Size: N/A'; finalPreview.innerHTML = `

Unlocked PDF will appear here

Original Size: N/A
Unlocked Size: N/A
`; resetUnlocker(); showNotification('All cleared. Upload a new PDF to start.', 'info'); } // Download PDF function downloadPdf() { if (!unlockedBlob) { showNotification('Please unlock a PDF first', 'warning'); return; } const name = fileName.value || 'unlocked-pdf'; const url = URL.createObjectURL(unlockedBlob); const a = document.createElement('a'); a.href = url; a.download = `${name}.pdf`; a.click(); URL.revokeObjectURL(url); showNotification('PDF downloaded successfully!', 'success'); } // Show notification function showNotification(message, type) { const existing = document.querySelector('.notification'); if (existing) existing.remove(); const notification = document.createElement('div'); notification.className = `notification ${type}`; notification.innerHTML = ` ${message} `; document.body.appendChild(notification); notification.style.position = 'fixed'; notification.style.top = '20px'; notification.style.right = '20px'; notification.style.padding = '15px 20px'; notification.style.background = type === 'success' ? '#4CAF50' : type === 'warning' ? '#FF9800' : '#2196F3'; notification.style.color = 'white'; notification.style.borderRadius = '8px'; notification.style.boxShadow = '0 4px 12px rgba(0,0,0,0.15)'; notification.style.zIndex = '1000'; notification.style.display = 'flex'; notification.style.alignItems = 'center'; notification.style.gap = '10px'; notification.style.animation = 'fadeIn 0.3s ease-out'; const style = document.createElement('style'); style.innerHTML = ` @keyframes fadeIn { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } } `; document.head.appendChild(style); setTimeout(() => { notification.style.animation = 'fadeOut 0.3s ease-out'; const fadeOutStyle = document.createElement('style'); fadeOutStyle.innerHTML = ` @keyframes fadeOut { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-20px); } } `; document.head.appendChild(fadeOutStyle); setTimeout(() => { notification.remove(); fadeOutStyle.remove(); }, 300); }, 3000); } // Initialize initEventListeners(); });