Skip to content

Windows html to docx fails to embed images in the docx file #316

Closed
@saumzzz

Description

@saumzzz

I have an html file which links to an image in the same folder, when converting from html to docx on windows it throws the error [WARNING] Could not fetch resource test.png: PandocResourceNotFound "test.png"

pypandoc-binary==1.10

html file:

<!DOCTYPE html>
<html lang="en">

<head>
  <title>Test Title</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">

<body>

  <h1 class="section">Test Heading</h1>

  <div class="row">
    <img src="test.png" alt="test alt" />
  </div>

</body>

</html>

python script

import pypandoc
 
pypandoc.convert_file(
    'index.html',
    to='docx',
    format='html',
    outputfile='test.docx',
)

output of python test.py:
[WARNING] Could not fetch resource test.png: PandocResourceNotFound "test.png"

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions