html2canvas

Cannot install jspdf 1.5.3

妖精的绣舞 提交于 2020-07-20 08:34:45
问题 I need to convert html to pdf and I am using jspdf 1.5.2. It shows the error Cannot read property 'charAt' of undefined (using with html2canvas). When I try to install jspdf 1.5.3 I get this: npm ERR! path git npm ERR! code ENOENT npm ERR! errno ENOENT npm ERR! syscall spawn git npm ERR! enoent Error while executing: npm ERR! enoent undefined ls-remote -h -t ssh://git@github.com/eligrey/FileSaver.js.git npm ERR! enoent npm ERR! enoent npm ERR! enoent spawn git ENOENT npm ERR! enoent This is

Cannot install jspdf 1.5.3

…衆ロ難τιáo~ 提交于 2020-07-20 08:34:06
问题 I need to convert html to pdf and I am using jspdf 1.5.2. It shows the error Cannot read property 'charAt' of undefined (using with html2canvas). When I try to install jspdf 1.5.3 I get this: npm ERR! path git npm ERR! code ENOENT npm ERR! errno ENOENT npm ERR! syscall spawn git npm ERR! enoent Error while executing: npm ERR! enoent undefined ls-remote -h -t ssh://git@github.com/eligrey/FileSaver.js.git npm ERR! enoent npm ERR! enoent npm ERR! enoent spawn git ENOENT npm ERR! enoent This is

Images cannot save into the localhost folder location

試著忘記壹切 提交于 2020-06-29 04:13:12
问题 I am create a function to download the images into my localhost folder, but it cannot save it to the localhost folder, because I am using the localhost to create the function. Hope someone can guide me how to solve it the problem. Below is my coding: <input id="btn-Preview-Image" type="button" value="Download"/> <script> $(document).ready(function(){ var element = $("#html-content-holder"); // global variable var getCanvas; // global variable $("#btn-Preview-Image").on('click', function () {

html2canvas image issue on firefox While working fine on chrome

痞子三分冷 提交于 2020-06-17 11:04:52
问题 I am using html2canvas.js and it's working 100% fine in chrome while in firefox it's not showing some div's which are arrows inside my target div am just converting image to base64 and sending it through ajax to server where I save image and generate pdf. On chrome image and pdf both match 100% with target div while when I try with mozilla it's not not rendering some arrows in image here is my js code html2canvas(div, { canvas: canvas, height: useWidth, width: useHeight, onrendered: function

How to show scrollable all contents of div in pdf using html2canvas

生来就可爱ヽ(ⅴ<●) 提交于 2020-06-17 03:28:27
问题 I have a simple div contains number of paragraph,that having particular height and vertical scroll beyond the height.When I am downloading the pdf only the visible part of the div is showing.But I need to show all the contents.Here is the code. html <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.4.1/jspdf.min.js"> </script> <div id="content"> <p>This is the element you only want to capture<

How to use addHTML in angular 4

扶醉桌前 提交于 2020-06-14 06:12:42
问题 I'm trying to use addHTML function of jspdf library in angular and have already installed html2Canvas but got an error. This is my demo.component.ts file. import { Component, OnInit, ViewChild, ElementRef } from '@angular/core'; import * as jsPDF from 'jspdf'; import * as html2canvas from "html2canvas"; @Component({ selector: 'app-demo', templateUrl: './demo.component.html', styleUrls: ['./demo.component.scss'] }) export class DemoComponent implements OnInit { @ViewChild('content') content

How to use addHTML in angular 4

柔情痞子 提交于 2020-06-14 06:10:47
问题 I'm trying to use addHTML function of jspdf library in angular and have already installed html2Canvas but got an error. This is my demo.component.ts file. import { Component, OnInit, ViewChild, ElementRef } from '@angular/core'; import * as jsPDF from 'jspdf'; import * as html2canvas from "html2canvas"; @Component({ selector: 'app-demo', templateUrl: './demo.component.html', styleUrls: ['./demo.component.scss'] }) export class DemoComponent implements OnInit { @ViewChild('content') content

Three.js canvas.toDataURL sometimes blank

淺唱寂寞╮ 提交于 2020-06-12 06:49:27
问题 I'm trying to render a THREE.js scene + some overlaid HTML elements using html2canvas.js. It works most times , but not all the time. In the failure cases, the HTML elements are rendered (the background, overlays, etc.) but nothing else. The THREE.js scene acts as if it's completely empty, even though it visibly has data in it. I can say that it usually fails for larger models, but only early into the rendering. It does eventually work in all cases, but the larger models take about 30 seconds

JS 如何将“在线图片资源”转换成“base64”

喜欢而已 提交于 2020-05-07 17:45:49
在实现html2canvas截图的功能时,会报下面的错误; Uncaught DOMException: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported 原因一:图片资源跨域 解决方法:将“跨域图片资源”转换成base64后,用base64渲染img标签,这样完美解决问题; 如何将“跨域图片”转换成base64呢?原理很简单,将img绘制成canvas,再将canvas转换成base64的img流; 因为图片是跨域的,所以我们在转换过程中需要加一段代码,用来处理跨域; image.crossOrigin = " * " ; // image.crossOrigin = 'Anonymous'; // 这个也可以 继续执行,发现偶尔还是报错,麻麻个蛋……继续填坑 Uncaught DOMException: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported 原因二:图片url缓存 在这里找到的方法: https://stackoverflow.com/questions/46609800/canvas

How to post immediately after svg to canvas conversion is done?

冷暖自知 提交于 2020-05-01 14:30:12
问题 I am attempting post with html2canvas after converting all the svgs in a html element to canvas, but the post executes immediately before the svg to canvas conversion finishes, since it takes a few seconds. I have tried using deferred and promises, but I am still having the same issue. // https://github.com/niklasvh/html2canvas/issues/95#issuecomment-45114424 // First render all SVGs to canvases targetElem = $('#dashboard'); var elements = targetElem.find('svg').map(function() { var svg = $