Transparency using html() method and doc.addImage() for the background.
jeromes80 opened this issue · comments
Hello,
First, thanks for your work on this very useful lib. I would like to report an issue encountered while using jspdf library for generating PDFs from HTML templates.
I've been trying to generate using the html() method. However, I've run into a problem as the div containers within the HTML template are all rendered with a white background. This prevents me from adding a background image effectively using doc.addImage()
I've explored various approaches to work around this issue (transparent color of my main container), but haven't found a satisfactory solution yet.
Perhaps there's a way to override the background color of the div containers
Any guidance or assistance you could provide on this matter would be greatly appreciated!
Sincerely yours,
I am also facing a similar problem, if any one has a solution please comment on this issue.
So, turns out (and you may already know) this js application uses html2canvas, so we can override it's default options by doing the following.
doc.html(source, {
callback: function (doc) {
// return doc;
window.open(doc.output("bloburl"));
},
x: 100,
y: 1250,
width: 2500,
autoPaging: true,
windowWidth: 800,
html2canvas: { backgroundColor: null },
});