jspdf

Exporting web page into PDF using jsPDf

偶尔善良 提交于 2019-12-11 13:19:22
问题 I am trying to export the webpage into pdf file when user click the button, but the below code is not working for me . can any one please help me where I went wrong. I am using jsPDF to export the web page into pdf. <!DOCTYPE html> <html lang="en"> <head> <title>html2canvas example</title> <script type="text/javascript" src="js/jquery/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="js/jquery/jquery-ui-1.8.17.custom.min.js"></script> <script type="text/javascript" src="js

Exporting HTML table to PDF with its format with jsPDF

一个人想着一个人 提交于 2019-12-11 12:58:29
问题 I'm using jspdf to export a table from html to PDF, however my table looks messed up: This is my table in html: And lastly, this is my code: function demoFromHTML() { var pdf = new jsPDF('p', 'pt', 'letter'); source = jQuery('#customers')[0]; specialElementHandlers = { // element with id of "bypass" - jQuery style selector '#bypassme': function(element, renderer) { // true = "handled elsewhere, bypass text extraction" return true } }; margins = { top: 30, bottom: 60, left: 60, width: 700 };

JSPDF - Use lots and lots of images

纵饮孤独 提交于 2019-12-11 10:31:00
问题 In JSPDF, my goal is to create a document that can vary from 1 to 1000 pages. Moreover, there are about 10-30 images on each page. I am using the basic syntax: var doc, exampleImg; exampleImage = '64x64ConvertedDataURL'; doc = new jsPDF(); doc.addImage(exampleImg, 'PNG', 40, 20, 5, 5); With this syntax, it goes without saying that it crashes and burns if it's longer than 100 pages. With no images, it can do the 1000 pages in under a second. The dataURLs are converted 64x64 images. There are

jsPDF create PDF from .html and open in new window

时光总嘲笑我的痴心妄想 提交于 2019-12-11 10:15:00
问题 I am trying to use jsPDF to convert a .html file to PDF and open it in a new window. I am gnerating de PDF like this: function PDFFromHTML() { var doc = new jsPDF(); // We'll make our own renderer to skip this editor var specialElementHandlers = { '#editor': function(element, renderer){ return true; } }; // All units are in the set measurement for the document // This can be changed to "pt" (points), "mm" (Default), "cm", "in" doc.fromHTML('ticket.html', 15, 15, { 'width': 170,

HTML to PDF using js with utf-8 support

孤街醉人 提交于 2019-12-11 08:41:18
问题 I need to export a web page as pdf it's html content that I display in the browser, I want to give the user the capability to download it as pdf, I tried jsPDF but it doesn't support arabic I need pdf not word, and I need to do it in the client side. please help Thanks in advance, 回答1: Demo: http://jsfiddle.net/kumarrishikesh12/rwdL0rxh/ <script async src="//jsfiddle.net/kumarrishikesh12/rwdL0rxh/embed/"></script> OR function doit(){ if (!window.print){ alert("You need NS4.x to use this print

How to solve repeating dialog box save as pdf?

筅森魡賤 提交于 2019-12-11 07:26:33
问题 I am drawing chart using selection box and printed the chart in pdf format. This is the selection box and the layout code: <div class= "chart-column"> <div class="chart-3-5block-inner"> <div class="chart-block-title">Job & Internship by Category</div> <div class="chart-view" style="padding-top: 10px; padding-left: 10px"> <!-- //combo box options to select application filter --> <?php echo 'Category Group: '; echo '<select id="category_filter">'; echo '<option value="0" selected="selected"

Multipage pdf with html2Canvas

岁酱吖の 提交于 2019-12-11 07:18:50
问题 I am using react-typescript and I have successfully created a PDF file from an html page with the help of this ref Generating a PDF file from React Components But if we want to create a PDF with multiple pages then what to do? with a4 size page with appropriate margins at all sides and in each new page that margin should be applied. And here is my code. private printDocument() { const input = document.getElementById("pdf"); html2canvas(input) .then((canvas) => { const pdf = new jsPDF("p", "px

rendering tables with jsPDF

爱⌒轻易说出口 提交于 2019-12-11 06:53:28
问题 I am trying to render a table using jsPDF and I used this code from here but the problem is if the text is bigger than the cell borders, it goes outside the cell. Is there an easy way to make the text truncate or make the cell bigger in height to fit all the text inside ? $.each(table, function (i, row){ console.debug(row); $.each(row, function (j, cell){ doc.cell(10, 50,120, 50, cell, i); }) }) 回答1: I found that the support for tables overall is lacking in jsPDF so I made a plugin. It

Property 'autoTable' does not exist on type jsPDF

微笑、不失礼 提交于 2019-12-11 06:39:49
问题 I am using angular2 and Node JS . I have installed jspdf and jspdf-autotable both modules using npm . In angular-cli.json file, I have embedded the scripts: "scripts": [ "../node_modules/jspdf/dist/jspdf.min.js", "../node_modules/jspdf-autotable/dist/jspdf.plugin.autotable.js" ], In my component.ts file , I have imported these files as follows: import * as jsPDF from 'jspdf'; import * as autoTable from 'jspdf-autotable'; I have also tried these lines to import jspdf-autotable import {

jsPDF PubSub Error – “No unicode cmap for font”

女生的网名这么多〃 提交于 2019-12-11 05:34:38
问题 I'm trying to add a custom font to jsPDF. I converted my file to base64 and did the following: doc.addFileToVFS("font/rajdhani-regular-webfont.woff", base64enc); where base64enc is the base 64 encoded string then I add the font as follows: doc.addFont('font/rajdhani-regular-webfont.woff', 'rajdhani', 'normal'); doc.setFont('rajdhani'); however, I keep getting the following error [Error] jsPDF PubSub Error – "No unicode cmap for font" – Error: No unicode cmap for font — jspdf.min.js:9068 Error