jspdf

jsPDF: fromHTML vs addHTML

╄→尐↘猪︶ㄣ 提交于 2019-12-13 03:20:51
问题 I'm trying to export an html(within a div with ID), and have managed to do so with fromHTML(), but unfortunately it doesn't read/use any css I have. This said, I tried with addHTML function, but it looks like nothing happens when I use following code: function pdfExport(id) { window.html2canvas = html2canvas; var dddoc = new jsPDF('p', 'px', 'a4'); var elem_to_export = $("#cmodal-id-" + id)[0]; dddoc.addHTML(document.body, function(){ console.log('saving'); dddoc.save('test.pdf'); }); } Also,

How to edit Font Size for TextField() in JSPDF?

无人久伴 提交于 2019-12-13 02:55:39
问题 Good morning, Has anyone been able to edit the font size on a TextField() in JSPDF? I don't care if multi-line is true or false, I just need to be able to set the default font size of a TextField() . Here's my code, which comes from https://github.com/MrRio/jsPDF/blob/master/examples/js/acroforms.js: doc.text('TextField:', 10, 145); var textField = new TextField(); textField.Rect = [50, 140, 30, 10]; textField.multiline = true; textField.value = "The quick brown fox ate the lazy mouse The

Export HTML + CSS to PDF using Javascript

馋奶兔 提交于 2019-12-13 02:18:26
问题 I want to export a part of my html code to pdf, for this I am using the following code : <script language = "JAVASCRIPT"> var doc = new jsPDF(); var specialElementHandlers = { '#editor': function (element, renderer) { return true; } }; $('#download').click(function () { doc.fromHTML($('#mytable').html(), 15, 15, { 'width': 170, 'elementHandlers': specialElementHandlers }); doc.save('sample-file.pdf'); }); </script> but it doesn't support CSS .. how can I export it with its style ? 回答1: What

JSPDF create and attach to email

こ雲淡風輕ζ 提交于 2019-12-13 02:09:38
问题 I have some problems in send a mail with attachments. The attachment file is a pdf generated by JSPDF library. Firstly I start to generate the pdf and call the script PHP with Ajax, like the code below: var pdf = doc.output(); $.post( "/smt/mail.php", { data: pdf }, function(data) { console.log(data.resultado); } , 'json'); Also i tried with the line of code pdf = btoa(doc.output()); but the error seems the same. In the script PHP I have: $semi_rand = md5(time()); $mime_boundary = "=

html2canvas not working for large HTML content

眉间皱痕 提交于 2019-12-13 01:04:01
问题 I am trying to use html2canvas library, to save html that's dynamically generated and output to the page as image. If the HTML generated isn't too much, then the html2canvas would work just fine, however, if the html generated is really too big (when I try to print it, it's 70 pages), then the html2canvas will return a canvas object where canvas.toDataURL('image/png') returns data:; and that's it. I found a post online suggesting to change the maxInt in the html2canvas.js file to be Number

jsPDF - include other pdf

£可爱£侵袭症+ 提交于 2019-12-12 10:07:04
问题 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? 回答1: Unforfortunately, with jsPDF today (2018

doc.save() throwing error with jspdf

妖精的绣舞 提交于 2019-12-12 09:28:39
问题 When I try and use the save() function for jsPDF it's throwing the following error: ReferenceError: saveAs is not defined I'm just trying a very simple example: var doc = new jsPDF(); doc.text(20, 20, 'Hello world!'); doc.text(20, 30, 'This is client-side Javascript, pumping out a PDF.'); doc.addPage(); doc.text(20, 20, 'Do you like that?'); doc.save('test.pdf'); Anyone have any ideas what's wrong? 回答1: Found out what the issue was. The saveAs function is part of FileSaver.js so I just needed

JSPDF-Autotable colspan/rowpan issue

☆樱花仙子☆ 提交于 2019-12-12 09:04:26
问题 I have an html table with rowspan/colspan.I am using jspdf and jspdf-autotable for exporting that html table to pdf. However the pdf getting saved has a table which doesn't contain rowspan/colspan in actual table.How to do colspan/rowspan using jspdf-autotable? My current code is <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title id='title'>HTML Page setup Tutorial</title> <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.0.272/jspdf

Append Existing Pdf to Jspdf

Deadly 提交于 2019-12-12 08:16:10
问题 I am using the jspdf library to create a pdf and its working out great. I am now trying to append to that pdf another existing pdf. At the moment when my user clicks the download button it fires off two separate downloads. I was thinking that a work around might be creating two images and adding them to my pdf created with Jspdf. Has anyone appended an existing pdf to a pdf generated using jspdf? $(document).ready(function () { var doc = new jsPDF('p', 'pt', 'letter'); var imgData = 'cats.jpg

generate dynamic pdf with jsPDF library based on user input (fix error)

泪湿孤枕 提交于 2019-12-12 06:06:55
问题 So, I actually have this functionality working. With the below JS. The problem is upon submit, the next page should not reflect these changes, but instead ONLY reflect in the generated PDF. Currently the PDF is being generated correctly, but the second page or second view (what is generated in the PDF is shown on the current) this should not be the case, this static page should remain as is and just have the reflected changes viewable in the generated PDF. Here is actually the original