📄 Upload & Settings 📁
Drop your .docx files here or click to upload
Supports multiple files • Max 50MB per file
High Fidelity Mode (Server Processing)
Preserve Word Page Breaks 🔍 Preview & Results
📄
Upload a DOCX file to see live preview
🔄 Convert to PDF
🖨️ Print
📥 Download PDF
🔒 Privacy & Security Client Mode: Your documents never leave your browser – all processing happens locally on your device.
Server Mode: Documents are temporarily uploaded for high-fidelity conversion and automatically deleted after processing.
💡 Tip: For documents with complex formatting, headers/footers, or track changes, use High Fidelity Mode for best results.
`);
printWindow.document.close();
printWindow.focus();
setTimeout(() => {
printWindow.print();
}, 500);
}addToHistory(filename, mode, duration) {
const historyItem = {
filename,
mode,
duration,
date: new Date().toLocaleString()
};
this.history.unshift(historyItem);
this.history = this.history.slice(0, 5); // Keep only last 5
localStorage.setItem('pdfConverterHistory', JSON.stringify(this.history));
this.loadHistory();
}loadHistory() {
if (this.history.length === 0) {
this.historyList.innerHTML = `
No conversions yet
`;
return;
}
this.historyList.innerHTML = this.history.map(item => `
${item.filename}
${item.date} • ${item.mode} Mode • ${item.duration}s
`).join('');
}showError(message) {
this.errorContainer.style.display = 'block';
this.errorContainer.innerHTML = `
⚠️ Error: ${message}
`;
}hideError() {
this.errorContainer.style.display = 'none';
}clearFiles() {
this.files = [];
this.currentPreview = null;
this.fileList.style.display = 'none';
this.convertBtn.disabled = true;
this.printBtn.disabled = true;
this.downloadBtn.style.display = 'none';
this.resultsInfo.style.display = 'none';
this.progressContainer.style.display = 'none';
this.hideError();
this.previewArea.innerHTML = `
📄
Upload a DOCX file to see live preview
`;
}
}// Initialize the converter when the page loads
document.addEventListener('DOMContentLoaded', () => {
new WordToPDFConverter();
});// Add some additional CSS for better table handling
const additionalStyles = document.createElement('style');
additionalStyles.textContent = `
.preview-content table {
border-collapse: collapse;
width: 100%;
margin: 1rem 0;
}
.preview-content th,
.preview-content td {
border: 1px solid #000;
padding: 8px;
text-align: left;
vertical-align: top;
}
.preview-content th {
background-color: #f5f5f5;
font-weight: bold;
}
.preview-content img {
max-width: 100%;
height: auto;
margin: 0.5rem 0;
}
.preview-content ul,
.preview-content ol {
margin: 0.5rem 0;
padding-left: 2rem;
}
.preview-content li {
margin: 0.25rem 0;
}
.preview-content h1,
.preview-content h2,
.preview-content h3,
.preview-content h4,
.preview-content h5,
.preview-content h6 {
margin: 1rem 0 0.5rem 0;
font-weight: bold;
}
.preview-content h1 { font-size: 1.5em; }
.preview-content h2 { font-size: 1.3em; }
.preview-content h3 { font-size: 1.1em; }
.preview-content p {
margin: 0.5rem 0;
text-align: justify;
}
.preview-content strong {
font-weight: bold;
}
.preview-content em {
font-style: italic;
}
.preview-content u {
text-decoration: underline;
}
.preview-content blockquote {
margin: 1rem 0;
padding-left: 1rem;
border-left: 3px solid #ccc;
font-style: italic;
}
`;document.head.appendChild(additionalStyles);