html2canvas

Angular 2 - Import html2canvas

只愿长相守 提交于 2019-12-12 15:36:38
问题 I have installed html2canvas on my angular 2 project using npm install html2canvas --save . If I now go to any file and write import * as html2canvas from 'html2canvas' it gives the error: Cannot find module 'html2canvas' My package file looks like this: { ... "scripts": { ... }, "dependencies": { ... "html2canvas": "^0.5.0-beta4", ... }, "devDependencies": { ... } } The file on which I'm trying to import the html2canvas is: import { Injectable } from '@angular/core'; import * as jsPDF from

html2canvas doesn't get image full height

十年热恋 提交于 2019-12-12 15:10:15
问题 For some reason that I can't understand, the html2canvas is not capturing the whole height of the div. html2canvas($container, { height: $container.height(), onrendered: function(canvas) { var data = canvas.toDataURL('image/png'); var file = dataURLtoBlob(data); var formObjects = new FormData(); formObjects.append('file', file); $.ajax({ url: 'ajax_preview', type: 'POST', data: formObjects, processData: false, contentType: false, }).done(function(response){ console.log(response); //window

HTML2Canvas generating blank image in Ionic4 angular proj. No error in console. Same code generates proper image in plain html/javascript

柔情痞子 提交于 2019-12-12 09:11:14
问题 I have html2canvas installed and imported in home.page.ts in my Ionic4 angular test project. I have a plain 100px X 100px, yellow background div with a single line of text. I am passing this div to html2canvas to be downloaded as png. html2canvas is listing all steps (no errors) in the console and generating the png with the same size as the given div but the div is empty.It does not have the color of the div or the text. Changing the size of the div takes effect properly meaning the

HTML2Canvas does not render full div, only what is visible on screen?

亡梦爱人 提交于 2019-12-12 07:10:54
问题 I'm trying to use HTML2Canvas to render the contents of a div. Here is the code: var htmlSource = $('#potenzial-page')[0]; $('#btn').on("click", function() { html2canvas(htmlSource).then(function(canvas) { var img = canvas.toDataURL(); window.open(img); }); }); I'm using v5 beta 3. When this code runs, it only renders what is visible on the screen. The #potenzial-page div is essentially the entire page, minus the header and footer. All content in this div is visible by scrolling (there are

Optimize output of HTML2Canvas

爱⌒轻易说出口 提交于 2019-12-12 04:36:49
问题 I created a chart with amchart. I will later have to export it as PDF. As suggested here, I need to convert the chart first into SVG with html2canvas. It works, but the chart looks "broken": Is there any way to optimize the result? Here is an extract of my code: /* --- Chart --- */ var chart = AmCharts.makeChart("chartdiv1", { "type": "serial", // ... }); /* --- HTML2Canvas --- */ $('#cmd').click(function() { html2canvas($("#output"), { onrendered: function(canvas) { document.body.appendChild

How to rotate .png rendered from div with canvas 90° ccw?

喜欢而已 提交于 2019-12-12 01:09:07
问题 Let me start off by saying that I'm new to working with the Canvas element. I've managed to get a div to render as a png with jQuery and html2canvas.js, but I'd like to rotate the png 90 degrees counter-clockwise. I assume I need to do this in the canvas stage, before the outputting it as a png for it to be persistent even when the image is downloaded – how would I go about and accomplish that? This is what I've got at the moment, which is working (minus the rotation) html2canvas($("#portrait

Png file not downloading in Internet Explorer when using html2canvas.js in Jquery

a 夏天 提交于 2019-12-12 00:43:38
问题 I have a button in my application which exports the html elements to png file. I did this by using html2canvas.js. It is working fine in Google chrome and Mozilla firefox browsers. But it is not working in Internet Explorer. When i click that button in IE it is just showing the blank page. I have provided the code in the following. Any help is appreciated. $("#btnPng").click(function () { $("#divPulledPopUpButtons").hide(); html2canvas($("#pulledPopUp"), { onrendered: function (canvas) { var

html2canvas - is there to print a hidden DIV to pdf?

╄→гoц情女王★ 提交于 2019-12-11 18:45:14
问题 Background I have a table of records that uses the "tabulator" control to allow users to sort, filter etc. once they have the results they want in the table, I need to provide a way for users trigger the creation of a PDF per row, using a PDF template. At the top of the page, I have a drop down menu where they can select a template. For example, it will have options like this: pdf with blue logo pdf with pink logo etc. What I know how to do: 1. I know how to loop through the selected records

html2Canvas/jsPDF only converts the data in the viewport to pdf?

荒凉一梦 提交于 2019-12-11 17:23:11
问题 I am trying to use the html2Canvas to convert html content to pdf. I have one consent form which is long and we have to scroll like below. I have written below code to convert the consent form into pdf and later show it in a separate screen. let htmlGrid = document.getElementById('customContent'); const options = {background: "white", height: htmlGrid.clientHeight, width: htmlGrid.clientWidth}; html2canvas(htmlGrid, options).then((canvas) => { let doc = new jsPDF("p", "mm", "a4"); let imgData

Html2canvas color change and zoom

半腔热情 提交于 2019-12-11 17:06:31
问题 I've added a print functionality in a web page I designed. I used the html2canvas script. However somehow the structure of the page is altered. The web page looks like this: opened in Google Chrome but when the print button clicked it turns to this:. If I change manually the zoom to 50% in the printing menu all enters the page but the wrong color remains. <div id="test" class="body-content animated fadeIn"> <img id="screenshot" src="Images/printer.png" onclick="getScreenshot()"> <script src=