html2canvas

iFrame is not coming in screenshot - HTML2Canvas

有些话、适合烂在心里 提交于 2019-12-08 12:57:46
问题 I have tried many times for capturing iframe into screenshot using Html2Canvas. But not coming and except iFrame everything is coming. I have one web page with bootstrap menu and simple iframe. I want to take full page screen on button click. May i know what step i missing in code implementation. <input type="button" id="btnCapture" value="Capture" /> <script> $("#btnCapture").on("click", function () { captureAndUpload(); }); function captureAndUpload() { html2canvas(document.body, {

Add new page while generating pdf from html with dynamic content

◇◆丶佛笑我妖孽 提交于 2019-12-08 12:00:18
问题 I'm trying to generate pdf from html with dynamic content using pdfmake . its working good but having an issue. Html content is to large and pdf only generating one page and rest of the content from html is cut. How can I add other page to pdf if content is more than one page. Here is my code. createPdf(): void { var main = $('.main'); html2canvas(this.el.nativeElement, { onrendered: function (canvas) { var data = canvas.toDataURL(); var a4 =[ 595.28, 841.89]; var docDefinition = { pageSize:

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

generating pdf from Html in React using html2canvas and jspdf

倖福魔咒の 提交于 2019-12-08 05:22:57
问题 I have successfully generated the pdf from html2canvas and jspdf in React. But the problem is the image rendered in the pdf is stretched. Please let me know what the best option to do this kind of work is. Is there any possibility of rendering the HTML directly to pdf without using html2canvas? Below are my screenshots Output Screenshot and pdf's screenshot Below is my code import React, { Component } from 'react'; import * as jsPDF from 'jspdf'; import * as html2canvas from 'html2canvas';

html2canvas print svg with position absolute value fail

折月煮酒 提交于 2019-12-08 01:08:38
问题 Please run the code below, you can see: The red line is not print to canvas. What's wrong with position absolute value? How can I fix it? Thanks. <!DOCTYPE html> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> </head> <body> <div id="Screenshot" style="height:200px; width:300px;"> <p>This is it</p> <svg width="138" height="14" version="1.1" xmlns="http://www.w3.org/2000/svg" > <path d="M 5 0 C 71 10 71 10 137 0 " transform="translate(0,3

Html2canvas renders page with wrong layout in IE11 whed devtools not opened

这一生的挚爱 提交于 2019-12-07 18:52:11
问题 I am trying to fix bug in related to rendering web page to canvas via html2canvas in IE11. Issues is a bit confusing: site implements responsible layout with bootstrap 2.3 grid. When developer tools not opened it is rendered like for table/smartphones screen . But if I press F12 ( developer tools opens , no any other action performed) and click to render page it rendered as expected, for wide screen . Removed outdated link to old application. Not it does not exists on specified address. This

How encode in base64 a file generated with jspdf and html2canvas?

人走茶凉 提交于 2019-12-07 06:19:40
问题 i'm trying encode the document generated in the attached code, but nothing happens, not generate error but neither encodes the file, and the ajax request is never executed what is the correct way? html2canvas(document.getElementById("workAreaModel"), { onrendered: function(canvas) { var img = canvas.toDataURL("image/png"); var doc = new jsPDF("l", "pt", "letter"); doc.addImage(img, 'JPEG',20,20); var fileEncode = btoa(doc.output()); $.ajax({ url: '/model/send', data: fileEncode, dataType:

html2canvas - no screenshot for iframe

喜欢而已 提交于 2019-12-07 03:42:00
问题 I have a task where i need to load a URL (e.g www.yahoo.com) , on my webpage, and take screenshot. I am using html2canvas for screenshot and appending it to the body of the page. The page specified by the URL is successfully loaded in an iframe inside a div element. But when i try to take screenshot of that, the iframe area comes blank. Below is the code for previewURL and screenshot . //to preview the URL content function previewUrl(url,target){ //use timeout coz mousehover fires several

Html网页DIV截图功能

瘦欲@ 提交于 2019-12-06 15:53:16
需求及前提: (1) 将web网页展示的某些图表,导出为图片保存; (2) 图表可能是Canvas的(使用H5绘图组件生成的或者自己Draw的),也可能是div组合出来的; 方案1: 使用html2canvas(某些浏览器需要引入依赖es6-promise.min.js,因为木有Promise对象) https://github.com/niklasvh/html2canvas https://github.com/stefanpenner/es6-promise 和 canvas2image https://github.com/hongru/canvas2image/blob/master/canvas2image.js 示例: $("#snap_btn_001").on("click",function(event){ event.preventDefault(); var w = $("#id001").width(); var h = $("#id001").height(); //这一坨代码是为了解决截图不清晰的问题,但是ratio应该根据浏览器的分辨率计算,这里先写死的一个数值 var ratio = 2; //要将 canvas 的宽高设置成容器宽高的 Ratio 倍 var canvas = document.createElement("canvas");

vue中html转pdf并下载功能

自闭症网瘾萝莉.ら 提交于 2019-12-06 12:42:20
/* eslint-disable */ //不使用JQuery版的 import html2canvas from 'html2canvas'; import JsPDF from 'jspdf'; /** * @param ele 要生成 pdf 的DOM元素(容器) * @param padfName PDF文件生成后的文件名字 * */ function downloadPDF(ele, pdfName) { window.scrollTo(0, 0); let eleW = ele.offsetWidth;// 获得该容器的宽 let eleH = ele.offsetHeight;// 获得该容器的高 let eleOffsetTop = ele.offsetTop; // 获得该容器到文档顶部的距离 let eleOffsetLeft = ele.offsetLeft; // 获得该容器到文档最左的距离 var canvas = document.createElement("canvas"); var abs = 0; let win_in = document.documentElement.clientWidth || document.body.clientWidth; // 获得当前可视窗口的宽度(不包含滚动条) let win_out = window