user5019310
user5019310

Reputation:

JSPDF output() do not show image

hi im using jspdf to create pdf file. i want to convert that into base64 and save it in the server. im using output method for that.

var output = doc.output()
var url = 'data:application/pdf;base64,' + Base64.encode(output);

the problem in this scenario is that images are not showing in the pdf. if i use doc.output('datauri') then it shows the images but it will open a new window. without opening the pdf, how can i get the pdf content with images to Base64

these are the script i have used

<script src="js/jspdf.debug.js"></script>
<script src="js/base64.js"></script>
<script src="js/jspdf.plugin.addimage.js"></script>

Upvotes: 0

Views: 3831

Answers (1)

user5019310
user5019310

Reputation:

found a solution

 var output = doc.output('datauristring') 
// var url = 'data:application/pdf;base64,' + Base64.encode(output);

'datauristring' returns the base64 encoded output. so no need to convert it again using base64 method.

Upvotes: 1

Related Questions