jspdf

Merge two PDF's generated with jsPDF into one document

[亡魂溺海] 提交于 2020-04-16 04:48:07
问题 I'm using jsPDF for generation of document from HTML (with using .html() method) and it works fine. But now I need to do next: Create jsPDF object. Add content with using .html() method. Add new page to created document. Add content to second page with using the same .html() method. Save created document. Here is the code example: var doc = new jsPDF({ orientation: 'p', format: 'a4' }); doc.html(document.getElementById('test'), { callback: function (doc) { doc.addPage('a4', 'p'); doc.html

HTML to PDF Conversion in android app

霸气de小男生 提交于 2020-03-27 08:15:51
问题 Is it possible to convert html to pdf using jsPdf in android app ( without using cordova or phone gap) and save the file in device local.? I tried this and onclick of button i am calling jspdf convertion logic, but pdf is not generating. In adb log I see below waring on click of button. Cannot call determinedVisibility() - never saw a connection for the pid: 1153 I am using jspdf library, Filesaver.js. 回答1: This class might help you. But to compile, it must be in package ".../java/android

How to add padding after page break using html2pdf

半腔热情 提交于 2020-03-25 19:01:28
问题 Converting vue.js html to pdf using html2pdf. Here everything is fine, Only thing i need to add padding-top and padding-bottom after pagebreak elements. Here is code that I tried. var element = document.getElementById('inner'); var opt = { margin: 0, filename: this.auth_user, image: {type: 'jpeg',quality: 0.98}, html2canvas: { scale: 2, bottom: 20 }, pagebreak: { mode: ['css']}, jsPDF: { unit: 'mm', orientation: 'portrait' } }; html2pdf().set(opt).from(element).then(function() { $("#inner")

JavaScript pdf generation library with Unicode support

℡╲_俬逩灬. 提交于 2020-03-18 05:33:46
问题 I want to generate a pdf file using JavaScript at client side . Firstly I tried using jsPdf API . But it does not work with Unicode character like Chinese. Is there any option to enhance jspdf to support Unicode or any other library which supports Unicode . Pdfmake API says it supports Unicode but when I tried it also does not work out, I checked in there demo example placing Unicode character . I tried using pdfkit in Node.js but pdf is not getting created properly var PDFDocument = require(

Where to change default pdf page width and font size in jspdf.debug.js?

霸气de小男生 提交于 2020-03-17 06:39:10
问题 I need to change default pdf page width and font size in jspdf.debug.js. Where and how to change the default values in jspdf.debug.js? 回答1: Besides using one of the default formats you can specify any size you want in the unit you specify. For example: // Document of 210mm wide and 297mm high new jsPDF('p', 'mm', [297, 210]); // Document of 297mm wide and 210mm high new jsPDF('l', 'mm', [297, 210]); // Document of 5 inch width and 3 inch high new jsPDF('l', 'in', [3, 5]); The 3rd parameter of

Export HTML content with Chart.jscanvases to PDF

痞子三分冷 提交于 2020-02-23 03:57:41
问题 I have an HTML page with around 10 charts generated by chart.js (so these are canvas elements). I want to be able to export the page content into a PDF file. I've tried using jsPDF's .fromHTML function, but it doesn't seem to support exporting the canvas contents. (Either that or I'm doing it wrong). I just did something like: $(".test").click(function() { var doc = new jsPDF() doc.fromHTML(document.getElementById("testExport")); doc.save('a4.pdf') }); Any alternative approaches would be

Open jsPDF created pdf in Chrome's new tab/window

六眼飞鱼酱① 提交于 2020-02-06 04:24:08
问题 How can I open with javascript link data:application/pdf;filename=generated.pdf;base64;DATA in Chrome 71? Link from console opened successfully, but not from code - unfortunately. The snippet does not work for security reason. Only for code demonstration. I read some similar questions, but did not find an answer. var button = document.getElementById("button"); button.addEventListener("click", generate, false); function generate() { var doc = new jsPDF({ orientation: "l", unit: "mm" }); doc

jsPDF - Importing fonts in React.js / ES6 style

故事扮演 提交于 2020-02-02 19:12:46
问题 I am trying to add a font in jsPDF in my React project. I converted the font to base64 and to a .js script using the provided generator at: https://rawgit.com/MrRio/jsPDF/master/fontconverter/fontconverter.html I import the font script as: import '../../assets/fonts/js/Muli-normal'; where Muli-normal is the converted Muli-normal.js file from Muli.ttf using the generator. I set the font with doc.setFont('Muli') but I get the error Line 10:5: 'jsPDF' is not defined no-undef The script is as

Cannot read property 'inlineReference' of undefined in rasterizeHTML from jspdf

走远了吗. 提交于 2020-01-16 17:08:27
问题 I'm using jspdf to render HTML to PDF in an Ember app. jspdf is included using the ember-js-pdf plugin, which is getting me jspdf v1.5.3. html2canvas seems to have recently moved to a promise-based model which jspdf isn't ready for, so I tried rasterizeHTML.js instead. Once I made it available in the app by adding app.import('node_modules/rasterizehtml/dist/rasterizeHTML.js'); I'm able to build, but then when I print I get this error: Uncaught TypeError: Cannot read property 'inlineReferences

Cannot read property 'inlineReference' of undefined in rasterizeHTML from jspdf

≡放荡痞女 提交于 2020-01-16 17:08:09
问题 I'm using jspdf to render HTML to PDF in an Ember app. jspdf is included using the ember-js-pdf plugin, which is getting me jspdf v1.5.3. html2canvas seems to have recently moved to a promise-based model which jspdf isn't ready for, so I tried rasterizeHTML.js instead. Once I made it available in the app by adding app.import('node_modules/rasterizehtml/dist/rasterizeHTML.js'); I'm able to build, but then when I print I get this error: Uncaught TypeError: Cannot read property 'inlineReferences