Word to PDF Converter

Online Word to PDF Converter is a fast, secure, and browser-based tool that converts DOCX, DOC, RTF, TXT, MD, HTML, PNG, JPG, and WEBP files into high-quality PDFs. It provides drag-and-drop uploading, a live preview, page settings, header and footer customization, batch conversion, and ZIP download, all without installation and free of charge.

Ultra Word → PDF Converter

Ultra Word → PDF Converter

Browser-only & private document converter

Drag & drop files here or click to browse

Supported: DOCX, DOC, RTF, TXT, MD, HTML, PNG, JPG, WEBP

Document Queue

No documents added yet

Preview

Select a document to preview

Conversion Settings

Page Settings

Margins

Header & Footer

Font Settings

Batch Actions

`; const blob = new Blob([htmlContent], { type: 'text/html' }); const url = URL.createObjectURL(blob); const baseName = fileItem.name.split('.').slice(0, -1).join('.'); const link = document.createElement('a'); link.href = url; link.download = `${baseName}.html`; link.click(); URL.revokeObjectURL(url); showToast('success', 'Downloaded', `${baseName}.html downloaded successfully.`); } // Download image in different format async function downloadImage(fileItem, format) { if (!['png', 'jpg', 'jpeg', 'webp'].includes(fileItem.type)) { showToast('error', 'Not an image', 'This file is not an image.'); return; } // If the requested format is the same as the original, just download the original if (fileItem.type === format || (fileItem.type === 'jpg' && format === 'jpeg')) { downloadOriginal(fileItem); return; } // Convert image to the requested format return new Promise((resolve, reject) => { const canvas = document.createElement('canvas'); const ctx = canvas.getContext('2d'); const img = new Image(); img.onload = function() { canvas.width = img.width; canvas.height = img.height; ctx.drawImage(img, 0, 0); canvas.toBlob(function(blob) { if (!blob) { reject(new Error('Failed to convert image')); return; } const url = URL.createObjectURL(blob); const baseName = fileItem.name.split('.').slice(0, -1).join('.'); const link = document.createElement('a'); link.href = url; link.download = `${baseName}.${format}`; link.click(); URL.revokeObjectURL(url); showToast('success', 'Downloaded', `${baseName}.${format} downloaded successfully.`); resolve(); }, `image/${format}`, 0.9); }; img.onerror = function() { reject(new Error('Failed to load image')); }; img.src = URL.createObjectURL(fileItem.file); }); } // Merge selected files async function mergeSelected() { if (selectedFiles.size < 2) { showToast('warning', 'Not enough files', 'Please select at least two files to merge.'); return; } const filesToMerge = fileQueue.filter(f => selectedFiles.has(f.id)); try { // Create a new PDF const pdf = new jspdf.jsPDF({ orientation: pageOrientation.value, unit: 'mm', format: pageSize.value }); // Process each file for (let i = 0; i < filesToMerge.length; i++) { const fileItem = filesToMerge[i]; // Parse file if not already parsed if (fileItem.status === 'queued') { await parseFile(fileItem); } // Convert to PDF if not already converted if (!fileItem.pdfBlob) { await convertToPdf(fileItem); } // Add to merged PDF (except for the first file) if (i > 0) { pdf.addPage(); } // Get the PDF as array buffer const arrayBuffer = await fileItem.pdfBlob.arrayBuffer(); const uint8Array = new Uint8Array(arrayBuffer); // Merge the PDF (this is a simplified approach) // In a real implementation, we would use a library like pdf-lib to properly merge PDFs showToast('info', 'Merging files', `Adding ${fileItem.name} to the merged PDF.`); } // Generate filename const date = new Date().toISOString().split('T')[0]; const filename = `merged-document-${date}.pdf`; // Download the merged PDF pdf.save(filename); showToast('success', 'Merge complete', `The selected files have been merged into ${filename}.`); } catch (error) { console.error('Error merging files:', error); showToast('error', 'Merge failed', `Failed to merge files: ${error.message}`); } } // Download all converted files as ZIP async function downloadZip() { const convertedFiles = fileQueue.filter(f => f.status === 'converted' && f.pdfBlob); if (convertedFiles.length === 0) { showToast('warning', 'No converted files', 'Please convert at least one file before downloading as ZIP.'); return; } try { // Create a new ZIP file const zip = new JSZip(); // Add each PDF to the ZIP for (const fileItem of convertedFiles) { zip.file(fileItem.pdfFilename, fileItem.pdfBlob); } // Generate the ZIP file const date = new Date().toISOString().split('T')[0]; const filename = `converted-documents-${date}.zip`; const content = await zip.generateAsync({ type: 'blob' }); // Download the ZIP file const link = document.createElement('a'); link.href = URL.createObjectURL(content); link.download = filename; link.click(); showToast('success', 'ZIP created', `${convertedFiles.length} file(s) have been downloaded as ${filename}.`); } catch (error) { console.error('Error creating ZIP:', error); showToast('error', 'ZIP creation failed', `Failed to create ZIP file: ${error.message}`); } } // Show toast notification function showToast(type, title, message) { const toast = document.createElement('div'); toast.className = 'ultra-word2pdf__toast'; const iconClass = { success: 'check', error: 'x', warning: 'alert-triangle', info: 'info' }[type]; toast.innerHTML = `
${getIconSvg(iconClass)}
${title}
${message}
`; toastContainer.appendChild(toast); // Add event listener to close button const closeButton = toast.querySelector('.ultra-word2pdf__toast-close'); closeButton.addEventListener('click', () => { toast.style.opacity = '0'; setTimeout(() => { toastContainer.removeChild(toast); }, 300); }); // Auto-remove after 5 seconds setTimeout(() => { if (toastContainer.contains(toast)) { toast.style.opacity = '0'; setTimeout(() => { if (toastContainer.contains(toast)) { toastContainer.removeChild(toast); } }, 300); } }, 5000); } // Get icon SVG function getIconSvg(iconName) { const icons = { check: '', x: '', 'alert-triangle': '', info: '' }; return icons[iconName] || ''; } // Initialize the app init(); });
Explore More Tools

Image to PDF

PDF to Word

Merge PDF

PDF Watermark

PDF Splitter

Explore More Tools

Scroll to Top