JPG to DOC Converter

📁

Drag & Drop your JPG files here

or

You can select up to 20 files at once

Converting... 0%
`; // Convert HTML to DOC format (using a simple approach) const blob = new Blob([htmlContent], { type: 'application/msword' }); docFile = blob; // Enable download downloadArea.style.display = 'block'; // Show success message showMessage(`Successfully converted ${files.length} file(s) to DOC format.`, 'success'); // Re-enable buttons convertBtn.disabled = false; clearBtn.disabled = false; } catch (error) { console.error('Conversion error:', error); showMessage('An error occurred during conversion. Please try again.', 'error'); convertBtn.disabled = false; clearBtn.disabled = false; progressArea.style.display = 'none'; } } function readFileAsDataURL(file) { return new Promise((resolve, reject) => { const reader = new FileReader(); reader.onload = () => resolve(reader.result); reader.onerror = reject; reader.readAsDataURL(file); }); } function clearAll() { files = []; docFile = null; // Update UI updateFilesPreview(); convertBtn.disabled = true; progressArea.style.display = 'none'; downloadArea.style.display = 'none'; // Clear file input fileInput.value = ''; // Hide any messages hideMessage(); } function showMessage(message, type) { statusMessage.textContent = message; statusMessage.className = `status-message ${type}`; statusMessage.style.display = 'block'; // Auto-hide success messages after 5 seconds if (type === 'success') { setTimeout(hideMessage, 5000); } } function hideMessage() { statusMessage.style.display = 'none'; } // Download button event listener downloadBtn.addEventListener('click', function() { if (docFile) { const url = URL.createObjectURL(docFile); const a = document.createElement('a'); a.href = url; a.download = 'converted_images.doc'; document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(url); } }); });