Download index.html from dpp002/docpix: direct link, hf CLI and curl.
- Browser
- Download file 17.9 kB
-
https://huggingface.co/spaces/dpp002/docpix/resolve/main/index.html
- Command line
-
hf download hf://spaces/dpp002/docpix/index.html
-
curl -L -o index.html https://huggingface.co/spaces/dpp002/docpix/resolve/main/index.html
17.9 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>PDF to DOC Converter</title> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> | |
| <style> | |
| .dropzone { | |
| border: 2px dashed #3b82f6; | |
| transition: all 0.3s ease; | |
| } | |
| .dropzone.active { | |
| border-color: #10b981; | |
| background-color: #f0f9ff; | |
| } | |
| .progress-bar { | |
| transition: width 0.3s ease; | |
| } | |
| #preview { | |
| max-height: 300px; | |
| overflow-y: auto; | |
| } | |
| </style> | |
| </head> | |
| <body class="bg-gray-50 min-h-screen"> | |
| <div class="container mx-auto px-4 py-8"> | |
| <div class="max-w-3xl mx-auto bg-white rounded-xl shadow-md overflow-hidden"> | |
| <!-- Header --> | |
| <div class="bg-gradient-to-r from-blue-500 to-indigo-600 p-6 text-white"> | |
| <div class="flex items-center justify-between"> | |
| <div> | |
| <h1 class="text-2xl font-bold">Document Converter</h1> | |
| <div class="flex space-x-4 mt-2"> | |
| <button id="pdf-to-doc-tab" class="tab-button active px-4 py-1 rounded-full bg-white text-blue-600 font-medium"> | |
| PDF to DOC | |
| </button> | |
| <button id="doc-to-pdf-tab" class="tab-button px-4 py-1 rounded-full bg-white/20 hover:bg-white/30 text-white font-medium"> | |
| DOC to PDF | |
| </button> | |
| </div> | |
| </div> | |
| <div class="bg-white/20 p-3 rounded-full"> | |
| <i class="fas fa-file-word text-2xl"></i> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Main Content --> | |
| <div class="p-6"> | |
| <!-- PDF to DOC Content (default visible) --> | |
| <div id="pdf-to-doc-content"> | |
| <!-- Upload Area --> | |
| <div id="upload-section" class="mb-8"> | |
| <div class="dropzone rounded-lg p-8 text-center cursor-pointer mb-4" id="dropzone"> | |
| <div class="flex flex-col items-center justify-center space-y-4"> | |
| <div class="bg-blue-100 p-4 rounded-full"> | |
| <i class="fas fa-file-pdf text-blue-600 text-3xl"></i> | |
| </div> | |
| <h3 class="text-lg font-medium text-gray-700">Drag & drop your PDF file here</h3> | |
| <p class="text-gray-500">or</p> | |
| <label for="file-input" class="bg-blue-600 hover:bg-blue-700 text-white px-6 py-2 rounded-md cursor-pointer transition"> | |
| <i class="fas fa-upload mr-2"></i> Select File | |
| </label> | |
| <input type="file" id="file-input" class="hidden" accept=".pdf"> | |
| </div> | |
| </div> | |
| <p class="text-sm text-gray-500 text-center">Supported formats: PDF (Max 10MB)</p> | |
| </div> | |
| <!-- File Info --> | |
| <div id="file-info" class="hidden mb-6 bg-gray-50 p-4 rounded-lg border border-gray-200"> | |
| <div class="flex items-center justify-between"> | |
| <div class="flex items-center space-x-3"> | |
| <i class="fas fa-file-pdf text-red-500 text-2xl"></i> | |
| <div> | |
| <h4 id="file-name" class="font-medium text-gray-800"></h4> | |
| <p id="file-size" class="text-sm text-gray-500"></p> | |
| </div> | |
| </div> | |
| <button id="remove-file" class="text-gray-400 hover:text-gray-600"> | |
| <i class="fas fa-times"></i> | |
| </button> | |
| </div> | |
| </div> | |
| <!-- Preview (simulated) --> | |
| <div id="preview-section" class="hidden mb-6"> | |
| <h3 class="text-lg font-medium text-gray-700 mb-3">Preview</h3> | |
| <div id="preview" class="bg-gray-100 p-4 rounded-lg border border-gray-300"> | |
| <p class="text-gray-500 italic">PDF preview would appear here in a real implementation</p> | |
| </div> | |
| </div> | |
| <!-- Options --> | |
| <div class="mb-6"> | |
| <h3 class="text-lg font-medium text-gray-700 mb-3">Conversion Options</h3> | |
| <div class="grid grid-cols-1 md:grid-cols-2 gap-4"> | |
| <div class="flex items-center space-x-2"> | |
| <input type="checkbox" id="preserve-layout" class="rounded text-blue-600" checked> | |
| <label for="preserve-layout" class="text-gray-700">Preserve original layout</label> | |
| </div> | |
| <div class="flex items-center space-x-2"> | |
| <input type="checkbox" id="include-images" class="rounded text-blue-600" checked> | |
| <label for="include-images" class="text-gray-700">Include images</label> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Progress Bar --> | |
| <div id="progress-section" class="hidden mb-6"> | |
| <div class="flex justify-between mb-1"> | |
| <span class="text-sm font-medium text-gray-700">Converting...</span> | |
| <span id="progress-percentage" class="text-sm font-medium text-gray-700">0%</span> | |
| </div> | |
| <div class="w-full bg-gray-200 rounded-full h-2.5"> | |
| <div id="progress-bar" class="progress-bar bg-blue-600 h-2.5 rounded-full" style="width: 0%"></div> | |
| </div> | |
| </div> | |
| <!-- Convert Button --> | |
| <div class="text-center"> | |
| <button id="convert-btn" class="bg-green-600 hover:bg-green-700 text-white px-8 py-3 rounded-md font-medium transition transform hover:scale-105 disabled:opacity-50 disabled:cursor-not-allowed disabled:transform-none" disabled> | |
| <i class="fas fa-exchange-alt mr-2"></i> Convert to DOC | |
| </button> | |
| </div> | |
| <!-- Download Section --> | |
| <div id="download-section" class="hidden mt-8 bg-green-50 border border-green-200 rounded-lg p-4"> | |
| <div class="flex flex-col md:flex-row items-center justify-between"> | |
| <div class="flex items-center space-x-3 mb-4 md:mb-0"> | |
| <div class="bg-green-100 p-3 rounded-full"> | |
| <i class="fas fa-file-word text-green-600 text-xl"></i> | |
| </div> | |
| <div> | |
| <h4 id="output-file-name" class="font-medium text-gray-800"></h4> | |
| <p class="text-sm text-gray-500">Conversion successful!</p> | |
| </div> | |
| </div> | |
| <button id="download-btn" class="bg-green-600 hover:bg-green-700 text-white px-6 py-2 rounded-md font-medium transition"> | |
| <i class="fas fa-download mr-2"></i> Download DOC | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Footer --> | |
| <div class="bg-gray-100 px-6 py-4 text-center"> | |
| <p class="text-sm text-gray-600">Convert your PDFs to editable Word documents in seconds</p> | |
| </div> | |
| </div> | |
| <!-- Info Box --> | |
| <div class="max-w-3xl mx-auto mt-6 bg-blue-50 border border-blue-200 rounded-lg p-4"> | |
| <div class="flex items-start space-x-3"> | |
| <div class="text-blue-500 mt-1"> | |
| <i class="fas fa-info-circle"></i> | |
| </div> | |
| <div> | |
| <h3 class="font-medium text-blue-800">How it works</h3> | |
| <p class="text-sm text-blue-600 mt-1"> | |
| This is a frontend demo. In a real implementation, you would need a backend service or API (like PDFTron, Adobe PDF Services, or other conversion libraries) to handle the actual PDF to DOC conversion. | |
| </p> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <script> | |
| document.addEventListener('DOMContentLoaded', function() { | |
| // Tab switching functionality | |
| const pdfToDocTab = document.getElementById('pdf-to-doc-tab'); | |
| const docToPdfTab = document.getElementById('doc-to-pdf-tab'); | |
| const pdfToDocContent = document.getElementById('pdf-to-doc-content'); | |
| const docToPdfContent = document.getElementById('doc-to-pdf-content'); | |
| pdfToDocTab.addEventListener('click', () => { | |
| pdfToDocTab.classList.remove('bg-white/20', 'text-white', 'hover:bg-white/30'); | |
| pdfToDocTab.classList.add('bg-white', 'text-blue-600'); | |
| docToPdfTab.classList.remove('bg-white', 'text-blue-600'); | |
| docToPdfTab.classList.add('bg-white/20', 'text-white', 'hover:bg-white/30'); | |
| pdfToDocContent.classList.remove('hidden'); | |
| docToPdfContent.classList.add('hidden'); | |
| }); | |
| docToPdfTab.addEventListener('click', () => { | |
| docToPdfTab.classList.remove('bg-white/20', 'text-white', 'hover:bg-white/30'); | |
| docToPdfTab.classList.add('bg-white', 'text-blue-600'); | |
| pdfToDocTab.classList.remove('bg-white', 'text-blue-600'); | |
| pdfToDocTab.classList.add('bg-white/20', 'text-white', 'hover:bg-white/30'); | |
| docToPdfContent.classList.remove('hidden'); | |
| pdfToDocContent.classList.add('hidden'); | |
| }); | |
| const dropzone = document.getElementById('dropzone'); | |
| const fileInput = document.getElementById('file-input'); | |
| const fileInfo = document.getElementById('file-info'); | |
| const fileName = document.getElementById('file-name'); | |
| const fileSize = document.getElementById('file-size'); | |
| const removeFileBtn = document.getElementById('remove-file'); | |
| const convertBtn = document.getElementById('convert-btn'); | |
| const previewSection = document.getElementById('preview-section'); | |
| const progressSection = document.getElementById('progress-section'); | |
| const progressBar = document.getElementById('progress-bar'); | |
| const progressPercentage = document.getElementById('progress-percentage'); | |
| const downloadSection = document.getElementById('download-section'); | |
| const outputFileName = document.getElementById('output-file-name'); | |
| const downloadBtn = document.getElementById('download-btn'); | |
| let selectedFile = null; | |
| // Drag and drop events | |
| ['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => { | |
| dropzone.addEventListener(eventName, preventDefaults, false); | |
| }); | |
| function preventDefaults(e) { | |
| e.preventDefault(); | |
| e.stopPropagation(); | |
| } | |
| ['dragenter', 'dragover'].forEach(eventName => { | |
| dropzone.addEventListener(eventName, highlight, false); | |
| }); | |
| ['dragleave', 'drop'].forEach(eventName => { | |
| dropzone.addEventListener(eventName, unhighlight, false); | |
| }); | |
| function highlight() { | |
| dropzone.classList.add('active'); | |
| } | |
| function unhighlight() { | |
| dropzone.classList.remove('active'); | |
| } | |
| dropzone.addEventListener('drop', handleDrop, false); | |
| function handleDrop(e) { | |
| const dt = e.dataTransfer; | |
| const file = dt.files[0]; | |
| handleFile(file); | |
| } | |
| // File input change | |
| fileInput.addEventListener('change', function() { | |
| if (this.files.length) { | |
| handleFile(this.files[0]); | |
| } | |
| }); | |
| // Handle the selected file | |
| function handleFile(file) { | |
| if (!file.type.includes('pdf')) { | |
| alert('Please select a PDF file.'); | |
| return; | |
| } | |
| if (file.size > 10 * 1024 * 1024) { // 10MB limit | |
| alert('File size exceeds 10MB limit.'); | |
| return; | |
| } | |
| selectedFile = file; | |
| fileName.textContent = file.name; | |
| fileSize.textContent = formatFileSize(file.size); | |
| fileInfo.classList.remove('hidden'); | |
| convertBtn.disabled = false; | |
| previewSection.classList.remove('hidden'); | |
| // Simulate preview (in a real app, you'd use a PDF viewer library) | |
| const preview = document.getElementById('preview'); | |
| preview.innerHTML = ` | |
| <div class="text-center py-8"> | |
| <i class="fas fa-file-pdf text-4xl text-red-500 mb-3"></i> | |
| <p class="font-medium">${file.name}</p> | |
| <p class="text-sm text-gray-500 mt-1">${formatFileSize(file.size)}</p> | |
| <p class="text-gray-500 italic mt-4">In a real implementation, this would show a preview of the PDF content.</p> | |
| </div> | |
| `; | |
| } | |
| // Remove file | |
| removeFileBtn.addEventListener('click', function() { | |
| selectedFile = null; | |
| fileInput.value = ''; | |
| fileInfo.classList.add('hidden'); | |
| convertBtn.disabled = true; | |
| previewSection.classList.add('hidden'); | |
| progressSection.classList.add('hidden'); | |
| downloadSection.classList.add('hidden'); | |
| }); | |
| // Convert button click | |
| convertBtn.addEventListener('click', function() { | |
| if (!selectedFile) return; | |
| // Show progress | |
| progressSection.classList.remove('hidden'); | |
| convertBtn.disabled = true; | |
| // Simulate conversion progress | |
| let progress = 0; | |
| const interval = setInterval(() => { | |
| progress += Math.random() * 10; | |
| if (progress > 100) progress = 100; | |
| progressBar.style.width = `${progress}%`; | |
| progressPercentage.textContent = `${Math.round(progress)}%`; | |
| if (progress === 100) { | |
| clearInterval(interval); | |
| setTimeout(showDownloadSection, 500); | |
| } | |
| }, 200); | |
| }); | |
| function showDownloadSection() { | |
| progressSection.classList.add('hidden'); | |
| downloadSection.classList.remove('hidden'); | |
| // Set output filename | |
| const originalName = selectedFile.name; | |
| const docName = originalName.endsWith('.pdf') ? | |
| originalName.replace('.pdf', '.doc') : | |
| originalName + '.doc'; | |
| outputFileName.textContent = docName; | |
| } | |
| // Download button click | |
| downloadBtn.addEventListener('click', function() { | |
| alert('In a real implementation, this would download the converted DOC file.'); | |
| // In a real app, you would: | |
| // 1. Get the converted file from your backend | |
| // 2. Create a download link like this: | |
| // const url = URL.createObjectURL(convertedFile); | |
| // const a = document.createElement('a'); | |
| // a.href = url; | |
| // a.download = outputFileName.textContent; | |
| // document.body.appendChild(a); | |
| // a.click(); | |
| // document.body.removeChild(a); | |
| // URL.revokeObjectURL(url); | |
| }); | |
| // Helper function to format file size | |
| function formatFileSize(bytes) { | |
| if (bytes === 0) return '0 Bytes'; | |
| const k = 1024; | |
| const sizes = ['Bytes', 'KB', 'MB', 'GB']; | |
| const i = Math.floor(Math.log(bytes) / Math.log(k)); | |
| return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i]; | |
| } | |
| }); | |
| </script> | |
| <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=dpp002/docpix" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> | |
| </html> |