GIF to DOC Converter

Drop your GIF files here or click to browse

Support up to 20 files at once. Maximum file size: 50MB per file

Selected files: 0
`;// Convert to blob with proper DOC MIME type return new Blob([htmlContent], { type: 'application/msword' }); }calculateImageSize(frame, quality) { let width = frame.width; let height = frame.height; // Apply quality scaling if (quality === 'medium') { width = Math.floor(width * 0.7); height = Math.floor(height * 0.7); } else if (quality === 'low') { width = Math.floor(width * 0.5); height = Math.floor(height * 0.5); } // Ensure maximum width for document const maxWidth = 600; if (width > maxWidth) { const ratio = maxWidth / width; width = maxWidth; height = Math.floor(height * ratio); } return { width, height }; }updateConvertButton(isLoading) { const btnText = this.convertBtn.querySelector('.btn-text'); const btnLoading = this.convertBtn.querySelector('.btn-loading'); if (isLoading) { btnText.style.display = 'none'; btnLoading.style.display = 'flex'; this.convertBtn.disabled = true; } else { btnText.style.display = 'block'; btnLoading.style.display = 'none'; this.convertBtn.disabled = this.files.length === 0; } }showProgressSection() { this.progressSection.style.display = 'block'; }hideProgressSection() { this.progressSection.style.display = 'none'; }initializeProgressList() { this.progressList.innerHTML = ''; this.files.forEach((file, index) => { const progressItem = document.createElement('div'); progressItem.className = 'progress-item'; progressItem.id = `progress-${index}`; progressItem.innerHTML = `
${file.name}
Waiting...
`; this.progressList.appendChild(progressItem); }); }updateProgressItem(index, status) { const progressItem = document.getElementById(`progress-${index}`); if (!progressItem) return; const statusElement = progressItem.querySelector('.progress-status'); statusElement.className = `progress-status ${status}`; switch (status) { case 'processing': statusElement.textContent = 'Converting...'; break; case 'completed': statusElement.textContent = 'Completed'; break; case 'error': statusElement.textContent = 'Error'; break; } }updateProgressStats(completed, total) { this.progressStats.textContent = `${completed} / ${total} completed`; }showDownloadSection() { this.downloadSection.style.display = 'block'; this.updateDownloadList(); }hideDownloadSection() { this.downloadSection.style.display = 'none'; }updateDownloadList() { this.downloadList.innerHTML = ''; this.convertedFiles.forEach((file, index) => { const downloadItem = document.createElement('div'); downloadItem.className = 'download-item'; downloadItem.innerHTML = `
${file.name}
`; this.downloadList.appendChild(downloadItem); }); }downloadFile(index) { const file = this.convertedFiles[index]; if (!file) return; const url = URL.createObjectURL(file.blob); const a = document.createElement('a'); a.href = url; a.download = file.name; document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(url); }async downloadAllAsZip() { if (this.convertedFiles.length === 0) return; try { const zip = new JSZip(); for (const file of this.convertedFiles) { zip.file(file.name, file.blob); } const zipBlob = await zip.generateAsync({ type: 'blob' }); const url = URL.createObjectURL(zipBlob); const a = document.createElement('a'); a.href = url; a.download = 'converted-docs.zip'; document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(url); } catch (error) { console.error('Error creating ZIP file:', error); alert('Error creating ZIP file. Please try downloading files individually.'); } }showErrorSection() { this.errorSection.style.display = 'block'; this.updateErrorList(); }hideErrorSection() { this.errorSection.style.display = 'none'; }updateErrorList() { this.errorList.innerHTML = ''; this.errors.forEach(error => { const errorItem = document.createElement('div'); errorItem.className = 'error-item'; errorItem.innerHTML = `
${error.fileName}
${error.error}
`; this.errorList.appendChild(errorItem); }); } }// Initialize the converter when the page loads let converter; document.addEventListener('DOMContentLoaded', function() { converter = new GIFToDOCConverter(); });