PDF to Word
Upload a PDF → convert pages to images → extract text with OCR. Fully private — everything runs in your browser.
Upload
Convert
Extract
1
Upload PDF
Drop your PDF here
or click to browse
Max 50MB • Works offline
-
0 KB
-
85%
2
Images & OCR
Rendering pages…
0 pages converted
Selected: English
Running OCR…
3
Extracted Text
No text extracted yet
Convert a PDF to images, then run OCR to extract text.
Avg. Confidence: 0%
📄 OCR Extracted Text
Language: ${lang}
Pages: ${ocrResults.length}
Extracted: ${date}
${currentRawText.replace(/\n/g, '
')}
')}
Generated by PDF to Word Converter • Powered by Tesseract.js
`;
const blob = new Blob([html], { type: 'application/msword' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = `OCR_Text_${lang}_${Date.now()}.doc`;
document.body.appendChild(a);
a.click();
setTimeout(() => { document.body.removeChild(a);
URL.revokeObjectURL(url); }, 100);
showToast('Word document downloaded!', 'success');
});
// ---- Download TXT ----
downloadTxtBtn.addEventListener('click', () => {
if (!currentRawText || !currentRawText.trim()) {
showToast('No text to download!', 'error');
return;
}
const lang = langNames[selectedLang] || 'Unknown';
const date = new Date().toLocaleString();
const content =
`OCR EXTRACTED TEXT
=============================
Language: ${lang}
Pages: ${ocrResults.length}
Extracted: ${date}
=============================
${currentRawText}
=============================
Generated by PDF to Word Converter · Powered by Tesseract.js`;
const blob = new Blob([content], { type: 'text/plain' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = `OCR_Text_${lang}_${Date.now()}.txt`;
document.body.appendChild(a);
a.click();
setTimeout(() => { document.body.removeChild(a);
URL.revokeObjectURL(url); }, 100);
showToast('Text file downloaded!', 'success');
});
// ---- Clear Text ----
clearTextBtn.addEventListener('click', () => {
textOutput.innerHTML = '';
currentRawText = '';
ocrResults = [];
confidenceInfo.classList.add('hidden');
textStats.classList.add('hidden');
textOutputContainer.classList.add('hidden');
textEmpty.classList.remove('hidden');
updateSteps(2);
showToast('Text cleared', 'info');
});
// ---- Global Reset ----
globalResetBtn.addEventListener('click', resetAll);
// ---- Init ----
resetAll();
showToast('Upload a PDF to get started', 'info');
})();