jspdf

export an array as table using jspdf

跟風遠走 提交于 2019-12-11 05:06:01
问题 I have my data in below format. [ {"Company":"XYZ1", "FName":"John", "LName": "Deere", "ID": 1234}, {"Company":"XYZ2", "FName":"Jack", "LName": "Jones", "ID": 2345}, {"Company":"XYZ3", "FName":"James", "LName": "Lebron", "ID": 3456} ] Is there a way to export the same data as 2 different tables into a PDF file ? I am using Angular 4 and jsPDF package. Table: 1 **Company** **FName** XYZ1 John XYZ2 Jack XYZ3 James Table: 2 **LName** **ID** Deere 1234 Jones 2345 Lebron 3456 回答1: You can use

jsPDF: justify text with custom font

空扰寡人 提交于 2019-12-11 04:52:08
问题 With jsPDF and a custom font, the option to justify text doesn't seem to work. Once you remove the custom font, the options works just fine. document.getElementById("get-pdf").addEventListener("click",getPDF); function getPDF(){ var doc = new jsPDF(); const helveticaNeueNormalBase64 = 'AAE...twC3/70='; const helveticaNeueMediumBase64 = 'AAEAAAAPADAAA...CgAAAGAAuQACAAE='; const helveticaNeueBoldBase64 = 'AAEAAAAPADAAAwDAT1...AAIAAQ=='; const fontShort = 'HelveticaNeue'; const fontStyleNormal =

Exporting HTML table to PDF with many columns using jsPDF

*爱你&永不变心* 提交于 2019-12-11 03:04:46
问题 I'd like to link this question that doesn't have any answers. Exporting HTML table to PDF with its format with jsPDF. I'm having the same problem with him and the tables looks exactly alike. I have a 20 column html table and I want them to be exported to pdf without any problem. I'm using jsPDF for exporting the table. I have tried the html <colgroup> tag for the column width of my table and it didn't work out. I have the first 8 columns showing and 12 columns hidden. I want all of them to be

jspdf is not able to capture the div content properly for highcharts to download as pdf format

孤街醉人 提交于 2019-12-11 02:47:19
问题 I want to download the content of html in the pdf fprmat,but here in my case I am using highcharts but when I download the pdf its not able to capture the content of chart,it can able to capture only text contents.I have used all the extra plugin like addimage,standard font etc even though it not able to print.is there any other plugin I need to use,or do I need to use any highcharts plugin for that,here is the code below $(function () { var specialElementHandlers = { '#editor': function

Render MathJax into PDF

假装没事ソ 提交于 2019-12-11 02:45:35
问题 I've spent days about how to render MathJax into PDF on client-side only (using several libraries like jsPDF, etc.) for the open source project Writing. I have tried many different options, without any success. Here is a code showing the problem in my latest attempt, based on this answer. MathJax.Hub.Config({ tex2jax: {inlineMath: [["$","$"],["\\(","\\)"]]} }); document.getElementById("getPdf").addEventListener("click", getPdf); function getPdf() { var svg = document.getElementById('main')

Getting image on page 1 of 2 page pdf

核能气质少年 提交于 2019-12-11 01:07:22
问题 I am creating an image with html2canvas and with jsPDF with Angular4. I want to place this image on page 1 of a 2 page generated pdf. But it seems that the line, doc.save('test.pdf'); needs to be inside the function just after htm2canvas() . Because if I place it outside this it will not include the image in the pdf. generatePDF(){ var doc = new jsPDF(); doc.text(50,90,this.problems.length.toString()); doc.text(50,100,'page 1') doc.addPage(); doc.text(50,100,'page 2') html2canvas(document

Can we send PDF file from AngularJS client to NodeJS server

旧街凉风 提交于 2019-12-10 23:33:21
问题 Using jspdf I have generated pdf file on the client side (AngularJS). I am able to successfully download the file. Now I have another function to send the pdf via email to user email address. Problem: When user clicks on send email button, the pdf which I created using jspdf should be uploaded to server and there I should be able to attach the pdf file which I got from client to email. Is it possible to do the same? I am not sure whether we can do this or not. Can we send the doc object in

HTML image to pdf convertor in javascript

空扰寡人 提交于 2019-12-10 21:32:58
问题 HTML CODE: <img class="imagepdf "src="www.images.com/someimage" alt="Smiley face" height="42" width="42"> I want to convert this image to pdf format. I am using jspdf() for this but i am not getting my output ?Can someone give me live example on fiddle for pdf conversion for chrome. 回答1: Here is code from it's github site var getImageFromUrl = function(url, callback) { var img = new Image(); img.onError = function() { alert('Cannot load image: "'+url+'"'); }; img.onload = function() {

Download a webpage in pdf format using angular4

99封情书 提交于 2019-12-10 18:37:07
问题 I am new for angular 4. I need to download a HTML webpage in pdf format and the html webpage contains angular controls like input [(ngModel)] , radio button [checked] . Rather than showing the control values it shows undefined in the pdf file. I tried using jsPdf & html2Pdf But it throws error Error: You need either https://github.com/niklasvh/html2canvas or https://github.com/cburgmer/rasterizeHTML.js at Object.jsPDFAPI.addHTML (jspdf.debug.js?6964:4049) Code for TS File: import { Component,

download PDF file from an Iframe content with jsPDF

假如想象 提交于 2019-12-10 16:08:27
问题 i want to save a PDF file which contains an IFrame Content. I use the jsPDF Javascript library for. Here is my Code as yet: function toPDF(){ var pdf = new jsPDF('p', 'in', 'letter'); // source can be HTML-formatted string, or a reference // to an actual DOM element from which the text will be scraped. source = $('#iframeid')[0] // we support special element handlers. Register them with jQuery-style // ID selector for either ID or node name. ("#iAmID", "div", "span" etc.) // There is no