jspdf

jsPDF not working on Safari

荒凉一梦 提交于 2019-12-19 09:54:09
问题 I need to have a button at the end of a HTML page that generates and saves a PDF, so I decided to try jsPDF. function pdfComprovativo(arg){ var doc = new jsPDF(); doc.text(20, 20, 'Hello world!'); doc.save('Test.pdf'); } I tested this on several browsers and it's not working for Safari (5.1.7 version). doc.output('dataurlnewwindow'); It works if I replace the save() with this, but I can't use this solution because of popup blockers. 回答1: I asked your question on Github, because I had the same

Blocked a frame with origin “http://localhost:8084” from accessing a cross-origin frame

泪湿孤枕 提交于 2019-12-19 07:54:43
问题 I'm trying to print a pdf generated by jspdf and loaded on iframe, but I'm getting that error message: "DOMException: Blocked a frame with origin "http://localhost:8084" from accessing a cross-origin frame." this is my code: <iframe id="pdf-prueba" name="pdf-box"></iframe> function open(){ var pdf = new jsPDF('p', 'mm', [55, 5]); var data = pdf.output('datauristring'); $('#pdf-box').attr("src", data).load(function(){ document.getElementById('pdf-box').contentWindow.print(); }); } 回答1:

Blocked a frame with origin “http://localhost:8084” from accessing a cross-origin frame

一笑奈何 提交于 2019-12-19 07:54:18
问题 I'm trying to print a pdf generated by jspdf and loaded on iframe, but I'm getting that error message: "DOMException: Blocked a frame with origin "http://localhost:8084" from accessing a cross-origin frame." this is my code: <iframe id="pdf-prueba" name="pdf-box"></iframe> function open(){ var pdf = new jsPDF('p', 'mm', [55, 5]); var data = pdf.output('datauristring'); $('#pdf-box').attr("src", data).load(function(){ document.getElementById('pdf-box').contentWindow.print(); }); } 回答1:

how to upload pdf to server from ajax data send (using jsPDF)

一个人想着一个人 提交于 2019-12-19 06:03:18
问题 I'm using jsPDF to generate a pdf on client-side. With the function doc.save('filename.pdf') I can download it. Now I need to save it on the server, so I'm sending the pdf data with .ajax() and receiving it with a PHP script but the images on the generated pdfURL doesn't show (http://mydomain/tmp/test.pdf); only shows the text. Can you give me a hand please? My js code: //doc.save('test.pdf'); WORKS WELL var pdf = doc.output(); $.ajax({ method: "POST", url: "inc/test.php", data: {data: pdf},

Align text right using jsPDF

ⅰ亾dé卋堺 提交于 2019-12-19 03:13:12
问题 I'm using jsPDF to create a PDF on the client side and I see there are properties to change the color, size, and font of the text, but I need to align the text to the right. So it's all aligned to a right coordinate. Kind of like text-align: right; in CSS. How would I go about doing this? Thanks 回答1: I have written an extension to jsPDF a while back that allows text aligning (and by default aligns top-left, instead of the random stuff jsPDF' .text function does). The code is written in

JSPDF Custom Font Add not working

旧城冷巷雨未停 提交于 2019-12-18 19:42:55
问题 CSS Code @font-face { font-family: Calibri; src: url("fonts/calibri.ttf"); font-style: normal; } JS Code doc.setFont('Calibri'); doc.setFontSize(7.5); doc.setFontType("normal"); doc.text(10, 10, "Hi, How r u"); I want to add Calibri Font, but it is not working List of js script included <script src="/assets/global/scripts/jspdf/jspdf.js" type="text/javascript"></script> <script src="/assets/global/scripts/jspdf/plugins/acroform.js" type="text/javascript"></script> <script src="/assets/global

How to display an image in two pages in PDF using jsPDF?

江枫思渺然 提交于 2019-12-18 11:12:15
问题 I have a html page. In which I have a button , whenerever I click this button it will convert the entire html page into data image using html2canvas and placed it into PDF using jsPDF library. The javascript which I am using is $("#printButton").click(function(){ html2canvas([document.getElementById('form1')], { onrendered: function (canvas) { var imageData = canvas.toDataURL('image/jpeg',1.0); var doc = new jsPDF('landscape'); doc.addImage(imageData,'JPEG',5,20,200,150); doc.save('Test.pdf')

jsPdf using html2canvas.js for export pdf from html is not working for large data

痞子三分冷 提交于 2019-12-18 09:24:04
问题 Hi I am using jsPdf for making pdf of html content, it is going fine for short content and creating pdf , but when I am trying to use it on large content with html2canvas.js (for rendering css), it is not creating pdf. Any suggestions or sample code for this would be helpful.Thank you. 回答1: It is possible to create pdf for large files. There are primarily two ways to do this : 1. html -> canvas -> image -> pdf (I assume you are trying this approach) 2. html -> pdf (does not work if html

jsPDF server side (node.js) usage using node-jspdf

我怕爱的太早我们不能终老 提交于 2019-12-18 06:03:48
问题 I am actually trying to include jspdf in server side and then use it for simple pdf generation(simply the text "Hello world!")(Go to the url- get the pdf localhost:8080). Now the first problem I face is How to include it / What to do to use jsPDF in node? While trying to install it using npm install node-jspdf then it gives following error- > G:\test\myproj>npm install node-jspdf node-jspdf@0.0.3 install G:\test\myproj\node_modules\node-jspdf sh install.sh 'sh' is not recognized as an

jsPDF server side (node.js) usage using node-jspdf

◇◆丶佛笑我妖孽 提交于 2019-12-18 06:03:12
问题 I am actually trying to include jspdf in server side and then use it for simple pdf generation(simply the text "Hello world!")(Go to the url- get the pdf localhost:8080). Now the first problem I face is How to include it / What to do to use jsPDF in node? While trying to install it using npm install node-jspdf then it gives following error- > G:\test\myproj>npm install node-jspdf node-jspdf@0.0.3 install G:\test\myproj\node_modules\node-jspdf sh install.sh 'sh' is not recognized as an