// Type definitions for html2canvas.js v1.4.1 (project-local)
// Project: https://github.com/niklasvh/html2canvas
// Definitions by: Richard Hepburn
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/* */
declare module Html2Canvas {
interface Html2CanvasOptions {
/** Whether to allow cross-origin images to taint the canvas */
allowTaint?: boolean;
/** Existing canvas element to use as a base for drawing on*/
canvas?: HTMLCanvasElement;
/** Canvas background color, if none is specified in DOM. Set null for transparent */
backgroundColor?: string | null;
/** Define the height of the canvas in pixels. If null, renders with full height of the window. */
height?: number;
/** Whether to render each letter seperately. Necessary if letter-spacing is used. */
letterRendering?: boolean;
/** Whether to log events in the console. */
logging?: boolean;
/** Url to the proxy which is to be used for loading cross-origin images. If left empty, cross-origin images won't be loaded. */
proxy?: string;
/** Whether to test each image if it taints the canvas before drawing them */
taintTest?: boolean;
/** Timeout for loading images, in milliseconds. Setting it to 0 will result in no timeout. */
imageTimeout?: number;
/** Define the width of the canvas in pixels. If null, renders with full width of the window. */
width?: number;
/** Whether to attempt to load cross-origin images as CORS served, before reverting back to proxy. */
useCORS?: boolean;
/** X-coordinate to crop from. */
x?: number;
/** Y-coordinate to crop from. */
y?: number;
/** The x-scroll position to used when rendering element. */
scrollX?: number;
/** The y-scroll position to used when rendering element. */
scrollY?: number;
/** Window width to use when rendering element. */
windowWidth?: number;
/** Window height to use when rendering element. */
windowHeight?: number;
/** Scale to use for rendering. */
scale?: number;
/** Remove the temporary container after rendering. */
removeContainer?: boolean;
/** Use ForeignObject rendering if supported. */
foreignObjectRendering?: boolean;
/** Optional callback to customize cloned document. */
onclone?(documentClone: Document): void;
/** @deprecated Legacy callback for old versions. */
onrendered?(canvas: HTMLCanvasElement): void;
}
}
interface Html2CanvasStatic {
/**
* Renders an HTML element to a canvas so that a screenshot can be generated.
*
* The screenshot is based on the DOM and as such may not be 100% accurate to the real representation as it does not make an actual screenshot,
* but builds the screenshot based on the information available on the page.
*
* @param {HTMLElement} element The HTML element which will be rendered to the canvas. Use the root element to render the entire window.
*/
(element: HTMLElement): Promise;
/**
* Renders an HTML element to a canvas so that a screenshot can be generated.
*
* The screenshot is based on the DOM and as such may not be 100% accurate to the real representation as it does not make an actual screenshot,
* but builds the screenshot based on the information available on the page.
*
* @param {HTMLElement} element The HTML element which will be rendered to the canvas. Use the root element to render the entire window.
* @param {Html2CanvasOptions} options The options object that controls how the element will be rendered.
*/
(element: HTMLElement|JQuery, options?: Html2Canvas.Html2CanvasOptions): Promise;
}
declare var html2canvas: Html2CanvasStatic;