Skip to content

feat(documents): Word (DOCX) to PDF converter - #148

Merged
slaveofcode merged 2 commits into
developfrom
feat/documents-docx-to-pdf
Aug 3, 2026
Merged

feat(documents): Word (DOCX) to PDF converter#148
slaveofcode merged 2 commits into
developfrom
feat/documents-docx-to-pdf

Conversation

@slaveofcode

Copy link
Copy Markdown
Owner

What

New Word (DOCX) to PDF converter in the Documents category — converts .docx to PDF entirely client-side, keeping layout, tables and images. Nothing is uploaded.

Two honest paths (fully client-side)

A pure-browser DOCX→PDF can't produce selectable text the way server-side LibreOffice would, so the tool offers both and is explicit about the trade-off:

  • Download PDF — renders with docx-preview, rasterizes each page with html2canvas, and assembles page-accurate PDF pages with pdf-lib. Visual/page-perfect; text is images. One click, real .pdf download.
  • Print / Save as PDF — the browser's own PDF export, for selectable, searchable text.

Deps / bundle

Reuses docx-preview and pdf-lib (both already deps). Only new dependency is html2canvas (MIT; npm audit clean). Its ~200KB chunk is a lazy dynamic import and excluded from the PWA precache (workbox globIgnore).

Details

  • src/tools/documents/docx-pdf.lib.ts — pure px→pt page-sizing (pxToPt, pageSizePt), 4 unit tests
  • src/islands/documents/DocxToPdf.tsx — thin island; per-page progress bar
  • Registered docx-to-pdf (beta); EN + ID SEO + OG
  • 674 tests pass · 0 lint errors · build green (/tools/docx-to-pdf + /id/...)

🤖 Generated with Claude Code

slaveofcode and others added 2 commits August 3, 2026 09:53
Promote to production: ODT Viewer
Convert .docx to PDF entirely client-side: render with docx-preview
(already a dep), rasterize each page with html2canvas, assemble page-
accurate PDF pages with pdf-lib (already a dep). Nothing is uploaded.

Offers both paths: one-click Download PDF (visual/page-perfect, text as
images) and Print / Save as PDF (browser export, selectable text) — the
UI is explicit about the difference. Progress bar over pages.

Only new dep is html2canvas (MIT, not flagged by npm audit); its ~200KB
chunk is a lazy dynamic import excluded from the PWA precache (globIgnore).
Pure px->pt page-sizing lib with 4 unit tests. Bilingual (EN + ID) UI,
SEO and OG.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ubfx4XocHcECaL8twp9zsr
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
goodwebtools c18cef3 Aug 03 2026, 07:43 AM

@slaveofcode
slaveofcode merged commit ceeca0a into develop Aug 3, 2026
2 checks passed
@slaveofcode
slaveofcode deleted the feat/documents-docx-to-pdf branch August 3, 2026 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant