html2canvas(domObj, {
           useCORS: true,//Whether to attempt to load cross-origin images as CORS served, before reverting back to proxy
           allowTaint: false,//Whether to allow cross-origin images to taint the canvas
           height: domObj.offsetHeight,//Define the heigt of the canvas in pixels. If null, renders with full height of the window
           width: domObj.offsetWidth,
           windowWidth: document.body.scrollWidth,
           windowHeight: document.body.scrollHeight,
           logging: false,//Whether to log events in the console
           x: 0,
           y: scrollTop, // 用网页滚动的高度定位y轴顶点
           dpi: window.devicePixelRatio,
           scale: 1,
         backgroundColor: null,//Canvas background color, if none is specified in DOM. Set undefined for transparent
           letterRendering: true,//Whether to render each letter seperately. Necessary if letter-spacing is used
           onclone (doc) {
                  console.log(doc);
            }
            }).then(canvas => {
                    // 微信里可长按保存或转发
                    const imgData = canvas.toDataURL('image/png');
                    console.log(imgData);
            })
    }
html2canvas配置
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
推荐阅读更多精彩内容
- 业务逻辑:在html页面显示表格,使用visibility: inherit; 隐藏该表格.点击按钮的时候使用ht...
 - 本周有个需求是将HTML渲染好的页面生成图片,用户在微信端使用的时候能够保存到相册。于是一顿搜索猛如虎之后,发现h...
 - 第一步:先引入对应的js,我引用的是老版本的,对应的js放在文章结尾了包含了这两个js(js版本也很重要哦,每个版...
 - 昨天遇到了一个业务问题,需要对界面进行截图并导出Word。我们是基于cesium做的,cesium的截图只能是对地...