question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

IMAGE commands in the document body are ignored when a Shape/image is already present in header or footer

See original GitHub issue

Sure ! Here is a very simple template that is failing. I’m using the method injectSvg() that is in the documentation : 7078ebf0-16fe-68d6-0e45-e78a25feb224.docx

createReport({
    template: templateFile,
    data: {
    },
    noSandbox: true,
    cmdDelimiter: ['{{', '}}'],
    additionalJsContext: {
        injectSvg: () => {
            const svg_data = Buffer.from(...., 'utf-8');
            return { width: 6, height: 6, data: svg_data, extension: '.svg' };
        }
    }
})

(Just replace the Buffer.from(...) by the one that is in the documentation)

And the generated document : fail.docx

_Originally posted by @matcobat in https://github.com/guigrpa/docx-templates/issues/144#issuecomment-870393351_

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

1reaction
matcobatcommented, Jul 5, 2021

Many thanks ! It’s working like a charm now !

1reaction
jjhbwcommented, Jul 2, 2021

Should be fixed in https://github.com/guigrpa/docx-templates/releases/tag/v4.6.4.

GH Actions should be publishing it to NPM right now. Let me know if you encounter anything weird. Thanks for reporting!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot use local file for --header-html and --footer-html #1645
I am using the library through a wrapper for nodejs. I was able to extract the command that is ultimately executed. wkhtmltopdf --header-html...
Read more >
Changing Header and Footer Commands in Notepad
To change headers and footers. Choose Page Setup from the File menu and enter the desired command(s) in the Header and Footer text...
Read more >
Adding an image to a header in LaTeX - TeX
So, is there a way to have these images ignore whitespace? graphics · header-footer · Share.
Read more >
background-size - CSS: Cascading Style Sheets | MDN
The background-size CSS property sets the size of the element's background image. The image can be left to its natural size, stretched, ...
Read more >
display | CSS-Tricks
Every element on a web page is a rectangular box. The display property in CSS determines just how that rectangular box behaves.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found