jspdf

Generating pdfs with jsPDF compatibility issues in Firefox?

吃可爱长大的小学妹 提交于 2019-12-10 12:09:51
问题 sorry for the inundation of PDF generation questions. I have been working on a project that converts a page into a multipage pdf(with jsPDF) using pagebreaks. I (finally!) got the project working in google Chrome but upon going to test it in Firefox, I was able to generate the first page, but the second two pages showed up entirely black. Here is the code: $(document).ready(function() { $("#runpdf").click(function(event) { var partsec = $("main_body page1"); html2canvas(document.body, {

Different width for each columns in jspdf autotable?

守給你的承諾、 提交于 2019-12-10 02:02:24
问题 My table has 13 columns. How can I get different width for each column? Can I give each column width like this? styles: {overflow: 'linebreak' ,columnWidth: [100,80,80,70,80,80,70,70,70,70,60,80,100]}, My table Syntax: > var res = doc.autoTableHtmlToJson(document.getElementById(tableID)); > doc.autoTable(res.columns, res.data, { styles: {overflow: 'linebreak' > ,columnWidth: [100,80,80,70,80,80,70,70,70,70,60,80,100]}, startY: > 60, bodyStyles: {valign: 'top'}, }); 回答1: You would have to

Angular2 - Generate pdf from HTML using jspdf

六眼飞鱼酱① 提交于 2019-12-08 16:05:09
问题 For a project I'm working on I need to be able to generate a PDF of the page the user is currently on, for which I'll use jspdf . Since I have a HTML I need to generate a PDF with, I'll need the addHTML() function. There are a lot of topic about this, saying You'll either need to use html2canvas or rasterizehtml . I've chosen to use html2canvas . This is what my code looks like at the moment: import { Injectable, ElementRef, ViewChild } from '@angular/core'; import * as jsPDF from 'jspdf';

How can I send PDF file from my angular fronted to my laravel backend

断了今生、忘了曾经 提交于 2019-12-08 14:38:22
I'm trying to send a PDF file created in angular, By the jsPDF plugin to my laravel backend. I tried getting the base64 datauristring. And sent it to the backend. Then I used the base64 decode and wrote it to storage. But I was unable to get the exact PDF file there was an error saying the file is broken . It depends on how you convert your page to pdf. If you use addHtml() , your datauristring starts with something like this data:application/pdf;base64 . But if you use newer version jsPDF and html() , then your datauristring is slightly different and will look like this data:application/pdf

Save generated PDF file in azure

佐手、 提交于 2019-12-08 12:50:38
问题 I have a form in ASP.NET and in when I fill up the form in the last step it generates a PDF file. I used jsPDF. What I want is that, the generated pdf file to be send (saved) in Azure storage, does anyone can help me? Thank you UPDATE: This is the code that I'm trying, it's working but it's extracting only the text, it doesn't save the pdf as it is: var account = new CloudStorageAccount(new Microsoft.WindowsAzure.Storage.Auth.StorageCredentials("storageaccount", "accesskey"), true); var

var not affected outside of function?

我的未来我决定 提交于 2019-12-08 08:57:41
问题 I am trying to convert an html into a pdf using jsPDF. However, the variable and things that happen inside a function seem to be invisible to everything outside of the function. Here is my code: $(document).ready(function() { $("#runpdf").click(function(event) { var doc = new jsPDF(); var imageData; html2canvas($("#page1"), { logging:true, profile:true, allowTaint:true, letterRendering: true, onrendered:function(canvas) { imageData= canvas.toDataURL("image/jpeg"); doc.addImage(imageData,

jsPDF addHTML method not working with no error message

情到浓时终转凉″ 提交于 2019-12-08 07:12:58
问题 I was using the example from jsPdf official demo site to test the new addHTML function, with a little change to directly save the PDF generated. console.log("testing"); var pdf = new jsPDF('p','pt','a4'); pdf.addHTML(document.body,function() { console.log("started"); pdf.save() console.log("finished"); }); console.log("testing again"); When I run the script above, it generates no error message but also no PDF is generated. In the console, only "testing" and "testing again" is shown, so I

Saving pdf on server side with jsPDF

独自空忆成欢 提交于 2019-12-08 06:42:30
I have an application that generates a HTML page with data which the user can edit. At the end I generate a .pdf file with jsPDF. Is there any way that I can save this generated .pdf on my server-side database? I'm using PrimeFaces. Thanks in advance Thanks all for the help! I've found my solution: Once the user presses on the button to generate the .pdf, I'll save all the data he filled on the database, just the data. When the user wants to see the pdf he generated back, I'll generate a new one with the data collected on his first submit. Thank you all for the answers, they were helpful.

Why html2canvas produced blurry pdf file?

冷暖自知 提交于 2019-12-08 06:28:20
问题 $('#generate').click(function() { var pdf = new jsPDF('p', 'pt', 'a4'); pdf.addHTML($('.pg-section').get(0), function() { pdf.save('Test.pdf'); }); }); .pg-section { background: white; } .pg-section h3 { padding: 5px; background: #808080; text-align: center; font-size: 14px; color: #FFF; font-weight: bold; margin-bottom: 10px; } .pg-tbl { margin: 15px 0; border-collapse: collapse; border: 2px solid blue; width: 100%; } .pg-tbl th { background: #ccc; text-align: center; } .pg-tbl th, .pg-tbl

jsPDF and cordova Cant view the pdf file

与世无争的帅哥 提交于 2019-12-08 06:19:02
问题 I'm trying to generate a PDF invoice for my app , I can get to the line 'console.log ("write success");' but I just cannot locate the file. Please help!!! How can I save it to a folder in my mobile??? console.log("generating pdf..."); var doc = new jsPDF(); doc.text(20, 20, 'HELLO!'); doc.setFont("courier"); doc.setFontType("normal"); doc.text(20, 30, 'This is a PDF document generated using JSPDF.'); doc.text(20, 50, 'YES, Inside of PhoneGap!'); var pdfOutput = doc.output(); console.log(