Skip to content

Configuration

These are all of the available configuration options.

NameDefaultDescription
allowTaintfalseWhether to allow cross-origin images to taint the canvas
backgroundColor#ffffffCanvas background color, if none is specified in DOM. Set null for transparent
canvasnullExisting canvas element to use as a base for drawing on
foreignObjectRenderingfalseWhether to use ForeignObject rendering if the browser supports it
imageTimeout15000Timeout for loading an image (in milliseconds). Set to 0 to disable timeout.
ignoreElements(element) => falsePredicate function which removes the matching elements from the render.
loggingtrueEnable logging for debug purposes
onclonenullCallback function which is called when the Document has been cloned for rendering, can be used to modify the contents that will be rendered without affecting the original source document.
proxynullUrl to the proxy which is to be used for loading cross-origin images. If left empty, cross-origin images won't be loaded.
removeContainertrueWhether to cleanup the cloned DOM elements html2canvas-pro creates temporarily
scalewindow.devicePixelRatioThe scale to use for rendering. Defaults to the browsers device pixel ratio.
useCORSfalseWhether to attempt to load images from a server using CORS
widthElement widthThe width of the canvas
heightElement heightThe height of the canvas
xElement x-offsetCrop canvas x-coordinate
yElement y-offsetCrop canvas y-coordinate
scrollXElement scrollXThe x-scroll position to used when rendering element, (for example if the Element uses position: fixed)
scrollYElement scrollYThe y-scroll position to used when rendering element, (for example if the Element uses position: fixed)
windowWidthWindow.innerWidthWindow width to use when rendering Element, which may affect things like Media queries
windowHeightWindow.innerHeightWindow height to use when rendering Element, which may affect things like Media queries

If you wish to exclude certain Elements from getting rendered, you can add a data-html2canvas-ignore attribute to those elements and html2canvas-pro will exclude them from the rendering.