Questions tagged [jspdf]

0

votes
0

answer
3

Views

How can I configure the width and height of html for jspdf?

I am wanting to generate a pdf based on an html file, using the jsPDF library. I want to set the width and height to render the pdf in the correct way. At this moment a very large html is generated and thus not being able to see the PDF properly I was researching the documentation of jsPDF, but I ca...
1

votes
1

answer
224

Views

How to show json data using jspdf in ionic 2?

I used jspdf to create a pdf file.I want to display json data in jspdf by using table. I used 'doc.autoTable' to display data in the form of table.How can i show the json data in a table. html code Download ts code exportpdf(){ var item=this.display; console.log(item); var columns = ['Employee Name'...
Kirandeep Kaur
1

votes
0

answer
181

Views

PhantomJS at the generation of pdf through jsPDF distorts images

When generating a pdf document using jsPDF using PhantomJS, the image quality in the export.pdf output file is very poor. The command to run the script: phantomjs test.js test.js var page = require('webpage').create(), fs = require('fs'); page.viewportSize = { width: 1280, height: 720 }; page.onLoad...
lifter
1

votes
1

answer
1.4k

Views

jspdf-autotable text word break

I'm having issues with the column headers text and the row text breaking incorrectly in the middle of the word (see attached). In the attachment I would expect the 'long text column' to be more squeezed which will increase the width of other columns and also increase the height of the rows. The cod...
Sam
1

votes
0

answer
301

Views

Rendering a page with html2canvas as if the browser window had a different size

I want to create a client-side PDF rendering of a page. The generated PDF should preserve CSS styles. To that end, I'm using html2canvas through jspdf: var doc = new jsPDF(); var html2canvasOpts = { background: '#ffffff' } doc.addHTML($('#mytargetelement')[0], html2canvasOpts, function () { doc.sa...
danidiaz
1

votes
0

answer
240

Views

jsPDF generate pdf from html table with rowspans

I am trying to generate a pdf from a html table using jsPDF. As rowspan is not supported i have tried to overwrite the drawCell function as seen on the examples from the official github:https://github.com/simonbengtsson/jsPDF-AutoTable/blob/master/examples/examples.js#L258. This is the code: ` drawC...
titus bocioc
1

votes
0

answer
271

Views

Convert only a particular div of an HTML page by its id into PDF

I am converting a particular div of an HTML page by its id into pdf with CSS but it is converting the contents of div which is currently visible but my content is more. i have to scroll then print but its only print which is currently visible and print black which is not visible div part. Contents H...
1

votes
0

answer
455

Views

styles not applying in created PDF using jsPDF in angular

Am using jsPDF for generating the pdf and able to generate pdf using the html template. ts as follows import { Component, OnInit, ViewChild, ElementRef } from '@angular/core'; import * as jsPDF from 'jspdf' @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app....
Rocky
1

votes
0

answer
39

Views

PDF of webpage generated from javascript is not same as the webpage

I am converting my webpage to PDF with the help of html2pdf.The code which converts webpage to html is as below $('#btnpdf').click(function() { var element = document.getElementById('target'); html2pdf(element,{ filename: 'MyPDF.pdf', image: { type: 'jpeg', quality: 1 }, }); }); The pdf...
NewBie
1

votes
1

answer
55

Views

Unable to implement jspdf using javascript?

I am trying to use jspdf to download a pdf and save it using javascript. Now, the problem is that when I try to execute jspdf function, I get this annoying error. I am using django with python. My goal is to be able to download the page using jspdf and then automatically trigger the print preview ev...
Rachel
1

votes
0

answer
271

Views

Sending Pdf, created with html2pdf, via Mail

I'm trying to send a document using eKoopmans html2pdf (new-api-branch) script via email. But since I'm not a trained programmer, I'm having a couple of problems with it. Here is my code so far $(document).ready(function(){ $('#cmd').click(function(){ var signaturefilename = $('#auftragsnummer').val...
1

votes
0

answer
113

Views

Change in execution of the size of the page in jspdf (vue.js)

How do I change the size of the sheet to print on a pos printer with jspdf (pdf)?. I create the object like that: doc = new JSPDF({ orientation: 'portrait', unit: 'mm', format: [55, 150] }); I add the other popiedades and, sometimes, I spare space. How to save paper by decreasing the size? Or increa...
marqueTTronica
1

votes
0

answer
97

Views

How to get the PDF from the Cytoscape graph without blurring the image?

I'm able to get the JPG and PNG images from the Cytoscape graph, but when converting them into PDF using jsPDF, the image shrinks and is blurry on zoom-in. Is there a way the image or graph can be converted to PDF without blurring?
CKA
1

votes
0

answer
304

Views

html2canvas and jspdf genereted blank pdf

Hi i created invoice page and added to them jsPDF and html2canvas, but my solution generated blank pdf. How can I repair this? where is a bug ? In my project used jspdf and html2canvas, can you help me with this? Script: $(document).ready(function() { function generatePDF() { window.scrollTo(0, 0)...
Paweł Sikora
1

votes
0

answer
33

Views

How exclude the export of subtable when you are already exported the root table via JSPDF using AngularJs

In the code bellow , i exported the table with tag #table1 using JSPDF and it works perfectly but i didn't find how i can exclude the export of the subtable using AngularJs, khnowing that, i fetch for a solution in the net but i just found Jquery solutions and not whithin AngularJs Any help pleas...
Basma Radadi
1

votes
0

answer
333

Views

html2canvas and jsPDF in angular5 low quality

This is my code in component and I tried many things. html2canvas(document.getElementById('content'),{scale: 1}).then(function(canvas){ var image=canvas.toDataURL('image/png'); canvas.getContext('2d').mozImageSmoothingEnabled = false; canvas.getContext('2d').imageSmoothingEnabled = false; var doc=ne...
1

votes
0

answer
117

Views

jsPDF save to serverside

My code is working correct. It's capturing and generating the whole page and prompting download too. But I need this to be saved on my server automatically in 'uploads/pdfs/' folder. I actually want to send this through php mail and save it on the server instead of prompting. Please help me. This is...
1

votes
0

answer
132

Views

Add html to a page ( jsPDF )

In the example you can add text to each page: 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?') I do not see in the examples that I can take the HMLT content of two DIVs on...
1

votes
0

answer
236

Views

Error when trying to create pdf from html using jsPdf

I got a error when i try to create pdf from html using jsPdf. Is there anything wrong with my code? thanks in advance error ng:///AppModule/TemplateComponent.ngfactory.js:198 ERROR TypeError: Cannot read property 'name' of undefined at k (vendor.bundle.js:69421) at r (vendor.bundle.js:69421) at vend...
rina
1

votes
0

answer
267

Views

jsPDF fromHTML image (to large) and page margin-bottom (not working)

I just implemented jspdf in a page, where users work with an editor and then want to be able to print the result. When I tested some example content, I run in to that problem the images are not displayed in there orignial size. They are scaled/displayed so large, that they are lager then the width o...
bulb
1

votes
1

answer
101

Views

unable to render CDN link images in jspdf using AddHTML

I am using addHtml to export div content as pdf with local images. It is working awesome, but images which have cdn links(server images) are not rendering. The code which I have tried: function exportChartToPDF() { var doc = new jsPDF('p', 'mm', 'A3', true); doc.internal.scaleFactor = 3.7...
VASANTHA K
1

votes
0

answer
106

Views

jsPDF PubSub Error Cannot read property 'widths' of undefined TypeError: Cannot read property 'widths' of undefined

I have issue below is my error in browser console jsPDF PubSub Error Cannot read property 'widths' of undefined TypeError: Cannot read property 'widths' of undefined at jspdf.min.js:171 at c (jspdf.min.js:171) I am using node package - 'jspdf': '^1.4.1' Please let me know , why issue come ?
Sagar Aher
1

votes
0

answer
89

Views

jsPDF working on first save, not updating on second in IE

I am trying to generate PDF from HTML using jSPDf and Html2Canvas.js, the code is working fine in Chrome but in IE it works fine first time, while generating PDF, second time the controls are overlapping and aligned to one side of PDF. Please provide the solution to generate the correct image on sec...
Nayan Chavan
1

votes
1

answer
338

Views

columns wrap jsPDF auto-table not working?

By looking at many examples online, it seems straightforward, but I am not able to wrap my columns (line break). I am not able to change the versions due to some internal conflicts where the code eventually goes. what I am doing wrong ? I used to make an object and pass it as a parameter to doc.auto...
jsPlayer
1

votes
0

answer
40

Views

How can I 3 columns inside a column using jspdf?

I need a little help related to autotable.I am using JSPDF library and I want to generate 3 columns(Fatal,Non-Fatal and Property Damage) horizontally under the column 2017.I tried to find through internet but could not find any solution. doc.setFontStyle('normal'); doc.setFontSize(12); var columns =...
Ahmed
1

votes
2

answer
669

Views

jsPDF addImage not working

I am using jsPDF to create a PDF by looping through some HTML code to find the values it needs. I am able to get the values just fine, but when I try to insert the header_img it does not work. I have found many solutions on Google but the one I am working with now is the only one that does not throw...
bigbluehouse
1

votes
0

answer
72

Views

Not able to print image getting from firebase storage into pdf file using html2canvas in web javascript

I am using html2canvas to print a web page into PDF file. The webpage is designed like a profile page with the data getting from the FireStore and image from Firebase storage. When i click on the export option in my webpage the pdf file is downloading with the data only. The profile image is not pr...
lakshmi
1

votes
0

answer
269

Views

Not able to add image to PDF using jspdf in IE11

I am using jsPDF to generate PDF file using JavaScript. In my PDF file I am adding images. I am able to generate PDF in Chrome and Firefox, but adding image to PDF creates security error in IE11. JS Code: (function() { var doc = new jsPDF(); doc.setFont('courier'); doc.setFontType('bolditalic'); doc...
1

votes
0

answer
222

Views

jsPDF - Angular: HTML to PDF

After I used jsPDF for generating pdf the whatsApp image looks like this in the pdf The code for converting image to base64 is as follows: getBase64Image(img) { console.log('=================', img); var canvas = document.createElement('canvas'); console.log('image', canvas); debugger; canvas.width...
AkshayP
1

votes
0

answer
240

Views

How to save JSPDF generated pdf in Angular assets folder?

I want to download my JSPDF generated PDF on Angular's assets folder. By default is getting downloaded in programs folder in disk-E. What should I need to change in my code. Here is my code: private download(): void { var pdf = new jsPDF('p', 'mm', 'letter'); let options = { pagesplit: true, backgro...
Vijay Sharma
1

votes
0

answer
264

Views

jsPDF export to pdf with style

I am trying to export the div content to PDF using jsPDF function demoFromHTML() { var pdf = new jsPDF('p', 'pt', 'letter'); // source can be HTML-formatted string, or a reference // to an actual DOM element from which the text will be scraped. source = $('#customers')[0]; // we support special...
Dorababu Meka
1

votes
0

answer
303

Views

Window open new tab giving blank page jspdf

Hi I am new to javascript,html,jspdf I am wondering why when I click save my pdf my pdf is saving but I wanted it to open in a new tab also I am using this code to save and open it in new tab but the new tab page only display blank page I would really appreciate advice window.open(doc.save('test.pdf...
CLOUDS
1

votes
1

answer
168

Views

jsPDF add image issue when opening with adobe Acrobat reader

On click of a button, I am creating a PDF, adding image and text to it, and then saving it to disk. var pdf = new jsPDF('l', 'pt', [1600, 1000]); var img = new Image; img.src = 'http://localhost:29576/Images/logo.png'; img.src = logoUrl; pdf.addImage(img, 10, 10) pdf.save(); Now everything works fin...
Simsons
1

votes
1

answer
330

Views

Html, css, img(svg) to pdf using js jspdf

i want convert a div to pdf and download it. I am using a svg image file which streches when i download it. This code is working well in safari browser. streches image in chrome and remove pictures in firefox Text is generated dynamically. this is the code i am using JS: // Define variables var for...
Muhammad Fahad
1

votes
0

answer
310

Views

Unable to add margin on addImage() function of jsPDF for multiple pages

I am trying to generate PDF of some html tables with jspdf. The addImage() function is working fine but when the size of image is more than the pdf page size the image continues on the next page as shown in the image above i am trying to add a margin or padding on every page so that it gets rendered...
Samrat Dey
1

votes
0

answer
46

Views

How to get data from canvas using canvas.toDataURL()?

I am using html2canvas and jsPDF for printing my html file. when my html page has horizontal scroll at that time image is cutting i uses following code var element = document.getElementsByClassName('ppm_portlet_data'); html2canvas(element[0]).then(function (canvas) { var data = canvas.toDataURL('ima...
Rahul Dudharejiya
1

votes
0

answer
35

Views

Textnode getting cropped when using html2Canvas to covert html to pdf

I started using html2Canvas. I'm trying to convert the below donut chart into a pdf using html2canvas and jspdf. The result is as follows: We can make out that text gets cropped. Then I tried to change the text next to donut chart to this : The result is so peculiar: Why do only specific text nodes...
Pooja
1

votes
0

answer
56

Views

How to make multiple page using jspdf

I want to make a multiple page PDF file using jspdf library. I used this code. But when this code is used, there is no margin(top) from 2page. I want to make multiple page and clear margin about all pages. Or give me a another way. this PDF make some noise. Please help me. function pdfDown(){ html2c...
Rosemary GAM
1

votes
1

answer
79

Views

How to generate pdf from angular2

My pdf file appears like this: I have a screen on click of print, whole screen must be converted to pdf format. I tried to do like this, but it is splitting the page, i am not able to get the whole screen properly. Please help. Ts: generateToPdf() { let pdf = new jsPDF('p','pt','a4'); pdf.setFontSi...
Bhrungarajni
1

votes
0

answer
38

Views

How to export particular div as pdf without using jspdf in angular?

I already tried by using html2canvas with the help of jspdf. But it downloads screenshot as a pdf and i'm not able to download overflowed table. I want to download directly without using print option.
susee cheetah

View additional questions