Download wordtopdf.html from Talha912/PDFIX: direct link, hf CLI and curl.
- Browser
- Download file 14.8 kB
-
https://huggingface.co/spaces/Talha912/PDFIX/resolve/main/wordtopdf.html
- Command line
-
hf download hf://spaces/Talha912/PDFIX/wordtopdf.html
-
curl -L -o wordtopdf.html https://huggingface.co/spaces/Talha912/PDFIX/resolve/main/wordtopdf.html
14.8 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>PDFix — Word to PDF Converter</title> | |
| <style> | |
| :root{--ink:#172033;--muted:#667085;--line:#e3e8f0;--blue:#185abd;--blue-dark:#104a9e;--bg:#f4f7fb;--soft:#edf4ff;--green:#147d50;--amber:#7a5a15} | |
| *{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--ink);font-family:"Segoe UI",Arial,sans-serif} | |
| header{height:70px;background:#fff;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;padding:0 26px;gap:14px} | |
| .brand{display:flex;align-items:center;gap:11px;text-decoration:none;color:inherit;font-size:21px;font-weight:800;letter-spacing:-.5px}.logo{width:38px;height:38px;border-radius:10px;background:linear-gradient(140deg,#185abd,#6c63ff);display:grid;place-items:center;color:#fff;font-weight:900}.brand small{display:block;color:var(--muted);font-size:10px;letter-spacing:1.7px;margin-top:2px} | |
| .back{border:1px solid var(--line);background:#fff;border-radius:9px;padding:10px 13px;text-decoration:none;color:var(--ink);font-size:13px;font-weight:700} | |
| main{max-width:1180px;margin:32px auto;padding:0 18px}.hero{text-align:center;margin:0 auto 25px;max-width:760px}.badge{display:inline-flex;gap:7px;align-items:center;background:var(--soft);color:var(--blue);padding:7px 11px;border-radius:999px;font-size:11px;font-weight:800;letter-spacing:.5px}.hero h1{font-size:clamp(30px,4.5vw,44px);letter-spacing:-1.2px;margin:14px 0 8px}.hero p{color:var(--muted);line-height:1.65;margin:0} | |
| .layout{display:grid;grid-template-columns:minmax(300px,390px) minmax(0,1fr);gap:18px;align-items:start}.card{background:#fff;border:1px solid var(--line);border-radius:16px;box-shadow:0 8px 25px rgba(25,39,70,.055);overflow:hidden}.card-head{padding:18px 20px;border-bottom:1px solid var(--line)}.card-head h2{font-size:16px;margin:0 0 5px}.card-head p{font-size:12px;color:var(--muted);line-height:1.5;margin:0}.card-body{padding:20px} | |
| .drop{border:2px dashed #bdcbe2;border-radius:13px;background:#f9fbff;text-align:center;padding:28px 14px;transition:.2s}.drop.drag{border-color:var(--blue);background:var(--soft)}.drop-icon{font-size:36px}.drop h3{font-size:16px;margin:9px 0 6px}.drop p{font-size:12px;color:var(--muted);line-height:1.55;margin:0} | |
| .btn{border:1px solid var(--line);background:#fff;color:var(--ink);border-radius:9px;padding:10px 13px;font-size:13px;font-weight:700;cursor:pointer}.btn.primary{background:var(--blue);border-color:var(--blue);color:#fff}.btn.primary:hover{background:var(--blue-dark)}.btn:disabled{opacity:.45;cursor:not-allowed}.choose{margin-top:15px} | |
| .filebox{display:none;align-items:center;gap:11px;border:1px solid var(--line);border-radius:11px;padding:12px;margin-top:13px}.docicon{width:40px;height:44px;flex:0 0 auto;border-radius:7px;background:#eaf1ff;color:var(--blue);display:grid;place-items:center;font-size:10px;font-weight:900}.filemeta{min-width:0;flex:1}.filemeta strong{display:block;overflow-wrap:anywhere;font-size:13px}.filemeta small{display:block;color:var(--muted);font-size:11px;margin-top:4px} | |
| .field{margin-top:16px}.field label{display:block;font-size:12px;font-weight:750;margin-bottom:7px}.field select,.field input[type=text]{width:100%;padding:10px;border:1px solid var(--line);border-radius:9px;background:#fff;font:inherit;font-size:13px}.field p{font-size:11px;color:var(--muted);line-height:1.5;margin:6px 0 0} | |
| .check{display:flex;align-items:flex-start;gap:9px;font-size:12px;line-height:1.5;color:#475467;margin-top:15px}.check input{margin-top:3px} | |
| .actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:20px}.actions .btn{flex:1} | |
| .status{font-size:12px;color:var(--muted);line-height:1.5;margin-top:12px;min-height:18px}.progress{display:none;margin-top:12px}.track{height:7px;background:#e9edf4;border-radius:20px;overflow:hidden}.bar{width:0;height:100%;background:linear-gradient(90deg,#185abd,#7464ff);transition:width .2s}.progress small{display:block;margin-top:6px;color:var(--muted);font-size:11px} | |
| .preview-head{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:15px 18px;border-bottom:1px solid var(--line)}.preview-head strong{font-size:14px}.preview-head span{font-size:11px;color:var(--muted)}.preview-area{min-height:490px;max-height:680px;overflow:auto;background:#edf0f5;padding:20px;display:flex;justify-content:center}.placeholder{max-width:350px;margin:auto;text-align:center;color:var(--muted);font-size:13px;line-height:1.6}.placeholder .paper{width:105px;height:135px;border:1px solid #d5dce7;background:#fff;margin:0 auto 18px;box-shadow:0 5px 15px #d8deea;display:flex;align-items:center;justify-content:center;font-size:34px}.docx-preview{width:100%;}.docx-preview .docx-wrapper{background:transparent!important;padding:0!important}.docx-preview section.docx{margin:0 auto 15px!important;box-shadow:0 4px 16px rgba(25,39,70,.15);max-width:100%} | |
| .limits{margin-top:18px;border:1px solid #ead8a6;background:#fffaf0;border-radius:13px;padding:16px 18px}.limits h3{font-size:13px;margin:0 0 8px;color:var(--amber)}.limits ul{padding-left:18px;margin:0;display:grid;grid-template-columns:1fr 1fr;gap:7px 22px}.limits li{font-size:11px;line-height:1.55;color:#6c5b36} | |
| .feature-row{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin-top:18px}.feature{background:#fff;border:1px solid var(--line);border-radius:12px;padding:14px}.feature b{font-size:12px}.feature p{font-size:11px;color:var(--muted);line-height:1.5;margin:6px 0 0} | |
| footer{text-align:center;color:var(--muted);font-size:11px;padding:27px 12px} | |
| #fileInput{display:none} | |
| @media(max-width:850px){.layout{grid-template-columns:1fr}.preview-area{min-height:330px}.feature-row{grid-template-columns:1fr}}@media(max-width:600px){header{padding:0 12px}.brand{font-size:18px}.back{font-size:11px;padding:8px}main{margin-top:22px;padding:0 11px}.card-body{padding:14px}.limits ul{grid-template-columns:1fr}.preview-area{padding:10px}.preview-head{padding:12px}} | |
| @media print{body{background:#fff}.no-print,header,.hero,.layout .card:first-child,.limits,.feature-row,footer{display:none!important}main{margin:0;padding:0;max-width:none}.layout{display:block}.layout .card{border:0;box-shadow:none}.preview-head{display:none}.preview-area{display:block;max-height:none;overflow:visible;padding:0;background:white}.docx-preview .docx-wrapper{padding:0!important}.docx-preview section.docx{box-shadow:none!important;margin:0!important;break-after:page}.docx-preview section.docx:last-child{break-after:auto}} | |
| </style> | |
| </head> | |
| <body> | |
| <header class="no-print"> | |
| <a class="brand" href="index.html"><span class="logo">P</span><span>PDFix<small>DOCUMENT TOOLS</small></span></a> | |
| <a class="back" href="index.html">← All PDF tools</a> | |
| </header> | |
| <main> | |
| <section class="hero no-print"> | |
| <span class="badge">● DOCX → PDF CONVERTER</span> | |
| <h1>Word to PDF</h1> | |
| <p>Preview your Word document, then print or save it as a PDF. This converter aims to preserve document styling better by rendering the DOCX before printing.</p> | |
| </section> | |
| <div class="layout"> | |
| <section class="card no-print"> | |
| <div class="card-head"><h2>Convert your document</h2><p>Upload a .docx file to preview it in the workspace.</p></div> | |
| <div class="card-body"> | |
| <div class="drop" id="dropZone"> | |
| <div class="drop-icon">📝</div><h3>Drop your Word file here</h3><p>Supports Microsoft Word .docx documents<br>Files are processed in this browser.</p> | |
| <button class="btn primary choose" id="chooseBtn" type="button">Choose Word file</button> | |
| </div> | |
| <input id="fileInput" type="file" accept=".docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document"> | |
| <div class="filebox" id="fileBox"><div class="docicon">DOCX</div><div class="filemeta"><strong id="fileName"></strong><small id="fileSize"></small></div><button class="btn" id="removeBtn" type="button">Remove</button></div> | |
| <div class="field"><label for="fileTitle">PDF file name</label><input type="text" id="fileTitle" value="converted-document" maxlength="100"><p>The browser print dialog may use this name, depending on your browser.</p></div> | |
| <label class="check"><input id="includeBg" type="checkbox" checked><span>Print background colours and images (if supported by the browser print dialog).</span></label> | |
| <div class="actions"><button class="btn" id="previewBtn" disabled>Refresh preview</button><button class="btn primary" id="printBtn" disabled>Print / Save as PDF →</button></div> | |
| <div class="status" id="status">Choose a DOCX file to begin.</div> | |
| <div class="progress" id="progress"><div class="track"><div class="bar" id="bar"></div></div><small id="progressText">Preparing preview…</small></div> | |
| </div> | |
| </section> | |
| <section class="card"> | |
| <div class="preview-head"><strong>Document preview</strong><span id="previewMeta">No document loaded</span></div> | |
| <div class="preview-area" id="previewArea"> | |
| <div class="placeholder" id="placeholder"><div class="paper">📄</div><strong>Your document preview will appear here</strong><br>Upload a Word file to review its layout before saving it as PDF.</div> | |
| <div class="docx-preview" id="docxPreview"></div> | |
| </div> | |
| </section> | |
| </div> | |
| <section class="limits no-print"> | |
| <h3>Important limitations — please read</h3> | |
| <ul> | |
| <li><b>Not guaranteed to be exactly identical to Microsoft Word.</b> Browser rendering can differ from Word.</li> | |
| <li>Fonts unavailable on your device may be substituted, changing line breaks and pagination.</li> | |
| <li>Complex tables, SmartArt, charts, equations, tracked changes, text boxes and advanced layout may render differently or incompletely.</li> | |
| <li>Headers, footers, page numbers, section breaks and page margins can vary by document and browser.</li> | |
| <li>Scanned content is displayed as part of the document only if embedded in the DOCX; this tool does not run OCR.</li> | |
| <li>For best results, use a modern desktop browser, review every page, and enable background graphics in the print dialog if needed.</li> | |
| <li>Conversion uses browser Print → Save as PDF. You must choose “Save as PDF” in the print dialog; the webpage cannot silently save the PDF for you.</li> | |
| <li>Files are processed locally by this page and are not uploaded to a PDFix server. External JavaScript libraries are loaded from CDNs.</li> | |
| </ul> | |
| </section> | |
| <section class="feature-row no-print"> | |
| <div class="feature"><b>📑 Preview first</b><p>Review page layout before exporting through your browser's print dialog.</p></div> | |
| <div class="feature"><b>🔒 Local processing</b><p>The document is read in your browser; it is not sent to a PDFix backend by this page.</p></div> | |
| <div class="feature"><b>🖨️ Print to PDF</b><p>Use your browser's built-in PDF printer to save the rendered document.</p></div> | |
| </section> | |
| </main> | |
| <footer class="no-print">PDFix · Word to PDF · Review the preview before exporting</footer> | |
| <script src="https://unpkg.com/docx-preview@0.3.3/dist/docx-preview.min.js"></script> | |
| <script> | |
| const $=id=>document.getElementById(id);let file=null; | |
| function setStatus(s){$('status').textContent=s} | |
| function size(n){return n<1024?n+' B':n<1048576?(n/1024).toFixed(1)+' KB':(n/1048576).toFixed(2)+' MB'} | |
| function clearFile(){file=null;$('fileInput').value='';$('fileBox').style.display='none';$('dropZone').style.display='block';$('docxPreview').innerHTML='';$('placeholder').style.display='block';$('previewMeta').textContent='No document loaded';$('previewBtn').disabled=true;$('printBtn').disabled=true;$('progress').style.display='none';setStatus('Choose a DOCX file to begin.')} | |
| async function loadFile(f){if(!f)return;if(!f.name.toLowerCase().endsWith('.docx')){alert('Please choose a .docx file. Legacy .doc files are not supported.');return}file=f;$('dropZone').style.display='none';$('fileBox').style.display='flex';$('fileName').textContent=f.name;$('fileSize').textContent=size(f.size);$('fileTitle').value=f.name.replace(/\.docx$/i,'');$('previewBtn').disabled=true;$('printBtn').disabled=true;await renderPreview()} | |
| async function renderPreview(){if(!file)return;try{$('progress').style.display='block';$('bar').style.width='10%';$('progressText').textContent='Reading Word document…';setStatus('Rendering preview…');$('docxPreview').innerHTML='';$('placeholder').style.display='none';const buffer=await file.arrayBuffer();$('bar').style.width='35%';$('progressText').textContent='Rendering pages and styles…';await docx.renderAsync(buffer,$('docxPreview'),null,{className:'docx',inWrapper:true,ignoreWidth:false,ignoreHeight:false,ignoreFonts:false,breakPages:true,ignoreLastRenderedPageBreak:false,experimental:false});$('bar').style.width='100%';$('progressText').textContent='Preview ready';$('previewMeta').textContent=friendlyPages();$('previewBtn').disabled=false;$('printBtn').disabled=false;setStatus('Preview ready. Review the document, then choose Print / Save as PDF.')}catch(e){console.error(e);$('placeholder').style.display='block';$('placeholder').innerHTML='<div class="paper">⚠️</div><strong>Could not render this document</strong><br>Try a valid DOCX file or open it in Microsoft Word / LibreOffice.';setStatus('Preview failed. The document may use unsupported features or be damaged.')} } | |
| function friendlyPages(){const n=$('docxPreview').querySelectorAll('section.docx').length;return n?`${n} rendered page${n===1?'':'s'}`:'Preview rendered'} | |
| $('chooseBtn').onclick=()=>$('fileInput').click();$('fileInput').addEventListener('change',e=>loadFile(e.target.files[0]));$('removeBtn').onclick=clearFile;$('previewBtn').onclick=renderPreview; | |
| const drop=$('dropZone');['dragenter','dragover'].forEach(ev=>drop.addEventListener(ev,e=>{e.preventDefault();drop.classList.add('drag')}));['dragleave','drop'].forEach(ev=>drop.addEventListener(ev,e=>{e.preventDefault();drop.classList.remove('drag')}));drop.addEventListener('drop',e=>loadFile(e.dataTransfer.files[0])); | |
| $('printBtn').onclick=()=>{if(!file)return;const name=($('fileTitle').value.trim()||'converted-document').replace(/[\\/:*?"<>|]/g,'-');document.title=name;$('previewArea').style.background='#fff';if(!$('includeBg').checked){document.body.classList.add('no-background-print')}else{document.body.classList.remove('no-background-print')}window.print();setTimeout(()=>{document.title='PDFix — Word to PDF Converter';$('previewArea').style.background='#edf0f5'},500)}; | |
| </script> | |
| <style>@media print{body.no-background-print *{print-color-adjust:economy;-webkit-print-color-adjust:economy}}</style> | |
| </body> | |
| </html> |