Reputation: 176
I'm using jsPDF (https://github.com/MrRio/jsPDF) to generate PDF out of web instance. The quality of the PDF output is lesser than the actual web instance. I have tried setting the image quality to 1 in the canvas.toDataURL(type, encoderOptions); but it didn't help. Is this a known issue? I'm using the addImage() method to put the image on the pdf before saving it. Example:
Upvotes: 0
Views: 2375
Reputation: 6426
If you can inject JavaScript into your web instance before the images are drawn and the images are drawn onto a canvas, you could fix your problem by capturing the vector instructions used to make up the images.
You create a mock canvas 2D context and then generate an SVG scene graph as you call canvas drawing commands. [...] You can't actually "transform" a canvas element that's been drawn to, as it's just a bitmap, so keep that in mind.
jspdf.plugin.sillysvgrenderer.js
: How to create easily a PDF from a SVG with jsPDF?This will add the images as native PDF objects.
Upvotes: 1