jspdf

HtmlToCanvas crops svg

五迷三道 提交于 2021-01-28 21:13:25
问题 Trying to achieve whats done here. Only problem my downloaded pdf has image croped brutally by right: I dive into and catch html2canvas method cause the issue not jspdf, So how can I force change svg to png properly using html2canvas component: import PrintButton from "../../../components/print/print"; function QrcodeComponent(props) { return ( <> <div id={"barcodeCont"}> <QRCode level="L" style={{ width: 256 }} value={JSON.stringify({})} /> </div> <PrintButton id="barcodeCont" /> </> ); }

jsPDF Incomplete or corrupt PNG file

纵饮孤独 提交于 2021-01-28 04:38:17
问题 Adding regular png images was no problem with jsPDF, but now i send a generated image from my server and the browser console displays this error when rendering the PDF file: Incomplete or corrupt PNG file obviously the image is not incomplete or corrupt because i can see the response from the server and the image is fine. Also to avoid render the pdf file before the image is ready i make a check to a that holds the image value variable if is undefined/null. the format of my image is var image

jsPDF Incomplete or corrupt PNG file

南楼画角 提交于 2021-01-28 04:24:04
问题 Adding regular png images was no problem with jsPDF, but now i send a generated image from my server and the browser console displays this error when rendering the PDF file: Incomplete or corrupt PNG file obviously the image is not incomplete or corrupt because i can see the response from the server and the image is fine. Also to avoid render the pdf file before the image is ready i make a check to a that holds the image value variable if is undefined/null. the format of my image is var image

jspdf Devnagari(Nepalese/ Hindi) Font

☆樱花仙子☆ 提交于 2021-01-24 08:10:54
问题 I want to generate pdf in Devanagari(Nepalese/ Hindi) font using jspdf. It is working but some words are not displaying properly. For Example: हाम्रो: हाम् रो, प्रकार: प् रकार const doc = new jsPDF(); doc.addFileToVFS('akchyar-unicode.ttf', nepali) doc.addFont('akchyar-unicode.ttf', 'custom', 'normal'); doc.setFont('custom'); doc.text(60, 20, 'हाम्रो प्रकार'); 来源: https://stackoverflow.com/questions/58153379/jspdf-devnagarinepalese-hindi-font

jspdf + html2canvas 实现html转pdf (提高分辨率版本)

痴心易碎 提交于 2021-01-23 22:56:06
刚解决了html中某div块生成pdf的问题,热乎乎的,赶紧记录下 引入的js传送门: https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.0.272/jspdf.debug.js https://cdn.bootcss.com/html2canvas/0.5.0-beta4/html2canvas.js 踩坑记录: 1.生成的pdf中,dom元素间距异常; 2.提高分辨率后,生成的图片有偏差 html语句: <div id="demo"> ... </div> 下载pdf的点击方法: download(){ var element = $("#demo"); // 这个dom元素是要导出pdf的div容器 var w = element.width(); // 获得该容器的宽 var h = element.height(); // 获得该容器的高 var offsetTop = element.offset().top; // 获得该容器到文档顶部的距离 var offsetLeft = element.offset().left; // 获得该容器到文档最左的距离 var canvas = document.createElement("canvas"); var abs = 0; var win_i = $(window)

JSPDF Autotable breaks rows

こ雲淡風輕ζ 提交于 2021-01-03 08:44:39
问题 In web app I'm using the JSPDF Autotable to build a PDF. The problem is that the data will be dynamic (I'm going to use AngularJS 1.x) and so the rows can have differents height. In some cases, Autotable breaks the last row of the page, continuing to the next one. How can I prevent this behavior, and set up Autotable to take the last row (which default would break) and bring it to the next page? This is my code: https://jsfiddle.net/9vgxvfkh/1/ I guess I have to change some settings in the

JSPDF Autotable breaks rows

半腔热情 提交于 2021-01-03 08:43:34
问题 In web app I'm using the JSPDF Autotable to build a PDF. The problem is that the data will be dynamic (I'm going to use AngularJS 1.x) and so the rows can have differents height. In some cases, Autotable breaks the last row of the page, continuing to the next one. How can I prevent this behavior, and set up Autotable to take the last row (which default would break) and bring it to the next page? This is my code: https://jsfiddle.net/9vgxvfkh/1/ I guess I have to change some settings in the

Convert Blob data to Raw buffer in javascript or node

為{幸葍}努か 提交于 2020-12-29 04:13:23
问题 I am using a plugin jsPDF which generates PDF and saves it to local file system. Now in jsPDF.js, there is some piece of code which generates pdf data in blob format as:- var blob = new Blob([array], {type: "application/pdf"}); and further saves the blob data to local file system. Now instead of saving I need to print the PDF using plugin node-printer. Here is some sample code to do so var fs = require('fs'), var dataToPrinter; fs.readFile('/home/ubuntu/test.pdf', function(err, data){

Convert Blob data to Raw buffer in javascript or node

£可爱£侵袭症+ 提交于 2020-12-29 04:12:55
问题 I am using a plugin jsPDF which generates PDF and saves it to local file system. Now in jsPDF.js, there is some piece of code which generates pdf data in blob format as:- var blob = new Blob([array], {type: "application/pdf"}); and further saves the blob data to local file system. Now instead of saving I need to print the PDF using plugin node-printer. Here is some sample code to do so var fs = require('fs'), var dataToPrinter; fs.readFile('/home/ubuntu/test.pdf', function(err, data){

“Tainted canvases may not be exported” issue still present after setting cross-origin on S3 bucket

五迷三道 提交于 2020-12-13 05:47:21
问题 The code below should convert html to pdf using html2canvas library and then download it, but it's showing this error: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported The issue is still present after allowing cross-origin on the S3 bucket. html2canvas(document.getElementById('compare'), { scale: window.devicePixelRatio, logging: true, allowTaint:true, onrendered: function (canvas) { var data = canvas.toDataURL(); var docDefinition = { content: [{