jspdf

Export HTML table to pdf using jspdf

烂漫一生 提交于 2019-12-17 04:27:10
问题 I need to export the HTML table to pdf file using jspdf. I tried the below code but it displays the blank/empty output in pdf file. Any suggestions or sample code for this would be helpful. ` <script type="text/javascript"> function demo1() { $(function () { var specialElementHandlers = { '#editor': function (element,renderer) { return true; } }; $('#cmd').click(function () { var doc = new jsPDF(); doc.fromHTML($('#htmlTableId').html(), 15, 15, { 'width': 170,'elementHandlers':

Export HTML page to PDF on user click using JavaScript

孤人 提交于 2019-12-17 04:25:07
问题 When user click on GeneratePDF button, I need to export the html page into a PDF file. I am successfully exporting HTML page into PDF file but for the first click only I am able to download data into PDF but from the second click I am unable to download the data to PDF file. I am not sure where I went wrong in the code. Please check the code here: $(function() { var doc = new jsPDF(); var specialElementHandlers = { '#editor': function(element, renderer) { return true; } }; $('#cmd').click

Not allowed to navigate top frame to data URL: JsPDF

淺唱寂寞╮ 提交于 2019-12-14 03:50:49
问题 try { var a; var b = new jsPDF("p", "pt", "a3"); var c = document.getElementById("leftPieCanvas").toDataURL("image/png"); b.addImage(c, "PNG", 265, 60); a = document.getElementById("rightPieCanvas").toDataURL("image/png"); b.addImage(a, "PNG", 205, 440); if ($("#sales_table").length) { var d = tableToJson($("#sales_table").get(0)); b.setFont("helvetica"); b.setFontType("bold"); b.setFontSize(9); $.each(d, function(a, c) { $.each(c, function(c, d) { b.cell(40, 830, 55, 20, d, a); }); }); } b

How to put and download the content of a div in html into pdf file using JS?

吃可爱长大的小学妹 提交于 2019-12-14 02:13:59
问题 I need to put the content of a div into a pdf file then download it. I've searched a bit and I found that you can use javascript to do this via jsPDF. I found this sample code but it seems that it doesn't work for me. When I click the generate pdf button nothing happens. I am also using codeigniter for my framework and my website is currently uploaded in 000.webhost.com. <div id="content"> <h3>Hello, this is a H3 tag</h3> <p>a pararaph</p> </div> <div id="editor"></div> <button id="cmd"

how to convert html <div> to pdf

前提是你 提交于 2019-12-13 11:15:16
问题 <div id="content"> <h3>Hello</h3> <table id = "tblHeader" > <tbody> <tr> <td width="10%">name</td> <td width="15%">id</td> <td width="27%">Patient Name </td> <td width="8%">Age</td> </tr> </tbody> </table> </div> <button id="cmd">generate PDF</button> This table I need to convert to pdf. I tried with jspdf and the function noted below. $(function () { $('#cmd').click(function () { var pdf = new jsPDF('p', 'pt', 'letter'), source = $('#tblHeader')[0], margins = { top: 40, bottom: 40, left: 40,

firefox hangs when displaying a pdf via data url

被刻印的时光 ゝ 提交于 2019-12-13 07:36:06
问题 I have an app which creates pdf in the browser using jspdf. I want to show this pdf in another tab/window. function open_data_uri_window(url) { var html = '<html>' + '<style>html, body { padding: 0; margin: 0; } iframe { width: 100%; height: 100%; border: 0;} </style>' + '<body>' + '<p>new viewer</p>' + '<iframe type="application/pdf" src="' + url + '"></iframe>' + '</body></html>'; var a = window.open("about:blank", "Zupfnoter"); a.document.write(html); a.document.close(); } It works fine in

Google Chart Export to PDF gives blackbackground in mozilla

Deadly 提交于 2019-12-13 04:47:25
问题 I am using following code to export googlechart as pdf. It is working fine in Google Chrome. Whereas in other browsers like mozilla its not woking properly. Following is my code : <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript" src="http://canvg.googlecode.com/svn/trunk/rgbcolor.js"></script> <script type="text

image to base64 conversion

孤者浪人 提交于 2019-12-13 04:18:44
问题 I want to convert a images to base64 format for my chrome extension. CODE: var img_src = $('#elementId').attr('src'); converImgToBase64(img_src) function convertImgToBase64(url) { var canvas = document.createElement('CANVAS'); ctx = canvas.getContext('2d'); img = document.createElement('img'), img.src = url; img.onload = function() { canvas.height = img.height; canvas.width = img.width; var dataURL = canvas.toDataURL('image/png'); alert(dataURL); var doc = new jsPDF(); doc.addImage(dataURL,

How to show an image in tooltip?

泄露秘密 提交于 2019-12-13 03:47:19
问题 I want to show an image in a tooltip when you have your mouse on a link. I'm using HTML, CSS and JAVASCRIPT/JQUERY. I have my image saved in a folder so I reference it from localhost. I have tried to set the content of the tooltip vía JQuery: $(document).ready(function() { $('#informe').tooltip("option","content","<img src='images/reports/informeInversiones.PNG' />"); $('#informe').tooltip("option","html","true"); $('#informe').tooltip("option","animated","fade"); $('#informe').tooltip(

Trying to open PDF File in Edge shows “Something's keeping this PDF file from opening” error

浪尽此生 提交于 2019-12-13 03:25:36
问题 I'm trying to open a PDF file in the Microsoft Edge browser. The PDF file is generated using jsPDF library in Angular 8. The code I've written is given below: import { Component, OnInit } from '@angular/core'; import * as data from '../dummy.json'; import * as jsPDF from 'jspdf'; import 'jspdf-autotable'; @Component({ selector: 'app-create-pdf', templateUrl: './create-pdf.component.html', styleUrls: ['./create-pdf.component.css'] }) export class CreatePDFComponent implements OnInit {