jsPDF icon indicating copy to clipboard operation
jsPDF copied to clipboard

Image base64 and fromHTML method in jsPDF

Open amnedge opened this issue 10 years ago • 2 comments

Hey people :)

i'm here because i use the method fromHTML to render my page into PDF and there is a problem on image render, I got some svg into this so i transform them into base64 png like this: <someHtml>...<img src="data:image/png;base64,iVBORw0KGgoAAAA..." />...<someHtml>

what i got by transforming svg into base64 png: image

And now what i got when I use fromHTML with this html: image

So we can see that the text is good but the image appear with a little zoom and blur, that's how I call the generation of PDF: doc.fromHTML(document.body, 15, 15,{ 'width': 560 }, function(){ doc.save(nameFichier+'.pdf'); });

amnedge avatar Feb 08 '16 16:02 amnedge

Hi there,

There's now an svg example :)

Get the latest master and try:

npm install
npm start

Then visit localhost:8000/examples/canvg_context2d/bar_graph_with_text_and_lines.html

Hope this works well for you :)

Many thanks, James

MrRio avatar Sep 28 '16 21:09 MrRio

maybe this helps you https://github.com/MrRio/jsPDF/issues/944

pablomaurer avatar Nov 11 '16 07:11 pablomaurer