Skip to content

--embed-resources is not respected in PDF conversion with WeasyPrint #11099

@jamiethecat

Description

@jamiethecat

Explain the problem.
The intermediary HTML when converting a DOCX or ODT to PDF with WeasyPrint always contains images as paths, even when --embed-resources is used.

Command to reproduce:

test.docx

pandoc test.docx --embed-resources --pdf-engine=weasyprint --output=test.pdf

Which fails with:

ERROR: Failed to load image at 'file:///home/monster/Downloads/media/image1.png': URLError: <urlopen error [Errno 2] No such file or directory: '/home/monster/Downloads/media/image1.png'>

The error matches the error you get when you use WeasyPrint directly without using --embed-resources in the original HTML conversion:

pandoc test.docx --output=test.html
weasyprint test.html test.pdf

The following works correctly:

pandoc test.docx --embed-resources --output=test.html
weasyprint test.html test.pdf

Pandoc version?
3.7.0.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions