jspdf

jsPDF - include other pdf

牧云@^-^@ 提交于 2019-12-06 08:06:50
I'm trying to solve such problem with jsPDF: I have PDF file, which is stored on server. I'm generating another pdf with jsPDF and trying to append to already existed pdf file (as I mentioned above) as a another page. I googled about it, but can't find any help. Also I found this question on stackoverflow, but it is different scenario - Append Existing Pdf to Jspdf How can I make this to work? Or is any other plugin or something else to make this? Unforfortunately, with jsPDF today (2018) it is not supported. Alternative solution But you could edit server side with free PHP library like FPDI .

jsPDF: html2canvas not loaded while using new .html() method

久未见 提交于 2019-12-06 07:38:33
问题 I want to use jsPDF.html to convert html page to pdf, and I'm using this code: savePdf () { var pdf = new jsPDF({unit: 'mm', format: 'a4', orientation: 'portrait' }) pdf.html(document.getElementById('printable-cv'), { callback: function (pdf) { pdf.save('cv-a4.pdf'); } }) } but I get error html2canvas not loaded : is it something I forgot? I do have html2canvas "html2canvas": "^1.0.0-alpha.12" I'm using vuejs with webpack. In the same page I'm currently using alternatively html2pdf with the

jsPDF: addHTML method not working

烈酒焚心 提交于 2019-12-06 06:16:53
I created html table and tried to generate pdf using jsPDF. I have used following code: var pdf = new jsPDF('p','pt','a4'); pdf.addHTML(document.getElementById('pdfTable'),function() { console.log('pdf generated'); }); pdf.save('pdfTable.pdf'); I am getting blank pdf file. Am I doing anything wrong? Here is a plunker for this. Working demo of jsPDF with addHTML function. Made working plunker for this: Update: I have updated the plunker and made it work with addHTML() function: var pdf = new jsPDF('p','pt','a4'); //var source = document.getElementById('table-container').innerHTML; console.log

Export whole html page to pdf using JSPdf generation

大憨熊 提交于 2019-12-06 05:52:44
I have already added these js file to my aspx page. But i still couldn't able to get pdf file of my table data. the generated pdf is blank.i need all table data to that generated pdf .please if any one know how to do this? <script src="../Script/jspdf.js"></script> <script src="../Script/FileSaver.js"></script> <script src="../Script/Blob.js"></script> <script src="../Script/BlobBuilder.js"></script> <script src="../Script/deflate.js"></script> <script src="../Script/adler32cs.js"></script> <script src="../Script/jspdf.plugin.addhtml.js"></script> <script src="../Script/jspdf.plugin.from_html

image in generated pdf corrupts pdf sent to server

不羁岁月 提交于 2019-12-06 00:08:12
I'm creating a PDF document in a web app with jsPDF, sending that document to Perl, and having Perl email it, and it works fine. However, when I add an image to the PDF document, it no longer works, as the Adobe Reader says the file is corrupt. The app is huge, so here is a stub with similar pertinent code that acts in the same way: html: <!DOCTYPE html> <html> <head> <script src="https://<myserver>/js/jquery.js"></script> <script src="https://<myserver>/js/jspdf.js"></script> <script src="https://<myserver>/js/jspdf.plugin.addimage.js"></script> <script src="https://<myserver>/test/pdf.js"><

How to save PDF file from jsPDF on a server in Javascript?

瘦欲@ 提交于 2019-12-05 13:30:07
var doc = new jsPDF(); $('#generatereport').click(function() { doc.fromHTML($('#lppresults')[0], 15, 15, { width: 170 }, function() { doc.save('sample-file.pdf'); }); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.4/jspdf.min.js"></script> <div class="survey-results" id="lppresults"> <button id="generatereport">Download Report</button> <h1 style="border: solid;">TEST CONTENT</h1><br /> <h1 style="border: solid;">TEST CONTENT1</h1> </div> I want to save file on the

jsPDF with Cordova - Adding images

两盒软妹~` 提交于 2019-12-05 13:15:22
I am trying to generate a PDF using the jsPDF library ( https://github.com/MrRio/jsPDF ) from within a mobile Cordova app. I am currently testing the app on an Android 4.0.4 device but it also needs to run on Windows mobile 8. The text in the PDF document is shown correctly however any images are scrambled. See image below I did find this page ( https://coderwall.com/p/nc8hia ) that seemed to indicate there is a problem with jsPDF displaying images in Cordova (see comments) but the author never posted the follow-up. Has anyone been able to use jsPDF with Cordova and properly add images to the

How encode in base64 a file generated with jspdf and html2canvas?

拜拜、爱过 提交于 2019-12-05 09:27:08
i'm trying encode the document generated in the attached code, but nothing happens, not generate error but neither encodes the file, and the ajax request is never executed what is the correct way? html2canvas(document.getElementById("workAreaModel"), { onrendered: function(canvas) { var img = canvas.toDataURL("image/png"); var doc = new jsPDF("l", "pt", "letter"); doc.addImage(img, 'JPEG',20,20); var fileEncode = btoa(doc.output()); $.ajax({ url: '/model/send', data: fileEncode, dataType: 'text', processData: false, contentType: false, type: 'GET', success: function (response) { alter('Exit to

Export html to PDF with JavaScript

守給你的承諾、 提交于 2019-12-05 03:06:29
问题 I want to export HTML to PDF with JavaScript, I saw libraries like jsPDF and pdfMake, but they are very limited. For example, with none of them I can export HTML elements, like <hr> , with jsPDF the styling is very limited, I saw this question but the answer is not working for me, with pdfMake I cannot download the pdf, just with chrome. 回答1: If you can retrieve the HTML from an URL you may want to check this answer that I wrote that explains how to do it. Example: https://dhtml2pdf.herokuapp

How to display a javascript File object in Chrome's PDF viewer with its name?

这一生的挚爱 提交于 2019-12-05 01:44:31
I've got a PDF file in the form of a Blob object (generated with jsPDF ), that I want to display in an <iframe> element. I can do that easily this way: iframe.src = URL.createObjectURL( blob ) The PDF is rendered correctly but I get an esoteric string in place of its name (see image below of Chrome's PDF viewer). So I tried to convert the Blob to a File object in order to give it a human-readable name. var file = new File( [blob], 'a_name.pdf', { type: 'application/pdf' } ) iframe.src = URL.createObjectURL( file ) It works with Firefox: the name is kept when saving the file from the header's