0

I have a div containing four images, all of which are graphs created in a separate file. I am trying to allow the user to click a download PDF button that will create a PDF file with all four graphs via jsPDF.

As of right now all I am getting is a blank PDF page to download, none of the images show. If I add a header or paragraph tag in the div, that will show up, but non of the images will.

How can I show the images mentioned in the PDF?

I have tried the solutions posted here and here as well , but to no avail.

Here is my JS

$(function () { var specialElementHandlers = { '#editor': function (element, renderer) { return true; } }; $('#downloadPDF').click(function () { var doc = new jsPDF(); doc.fromHTML($('#tables').html(), 15, 15, { 'width': 170, 'elementHandlers': specialElementHandlers }); doc.save('sample-file.pdf'); }); }); 

And the html

<div class="tab-pane fade" id="profile"> <div id="tables"> <img src='vendors.png' alt='vendors'> <img src='positives.png' alt='positives'> <img src='total_submissions.png' alt='total submissions'> <img src='unique_submissions.png' alt='unique submissions'> </div> <div id="editor"></div> </div> 
2
  • what is the the width of the image? and why are you specifying a width of 170 ? Commented May 23, 2017 at 23:25
  • The width of the image is 640px in the html, that didn't work so I tried using one of the examples I looked at Commented May 24, 2017 at 16:45

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.