Summary
DOCX export currently rewrites local-img:// URLs to file:// paths, but html-docx-js only embeds images that use data: base64 URIs. Local images are dropped from the exported document.
Fix
In the export-docx IPC handler in main.ts, before passing HTML to html-docx-js:
- Find all
file:// image src attributes
- Read each file with
fs.readFileSync()
- Convert to base64:
data:image/<ext>;base64,<data>
- Replace the
src attribute
The library's own test suite demonstrates this pattern works correctly.
Priority
Medium — tracked for v1.6.1
Related
Part of issue #11 (export to HTML and DOCX)
Summary
DOCX export currently rewrites
local-img://URLs tofile://paths, buthtml-docx-jsonly embeds images that usedata:base64 URIs. Local images are dropped from the exported document.Fix
In the
export-docxIPC handler inmain.ts, before passing HTML tohtml-docx-js:file://imagesrcattributesfs.readFileSync()data:image/<ext>;base64,<data>srcattributeThe library's own test suite demonstrates this pattern works correctly.
Priority
Medium — tracked for v1.6.1
Related
Part of issue #11 (export to HTML and DOCX)