web端div带地图导出png图片功能
web端div带地图导出png图片功能
在div带mars3d地图+统计表格数据的形式
//导出-png图片
const ExportReportPNG= async function() {
const mapImg = await mapReport.map.expImage({download: false}) //必须要有这一行才能显示地图图片
var reportBody = document.getElementById(“reportBody”);
html2canvas(reportBody, {
allowTaint: true,
useCORS: true,
}).then(divImgCanvas=>{
const base64 = divImgCanvas.toDataURL(“image/png”)
let newReportPath=dkinfo.dkmc + “_审查报告.png”;
mars3d.Util.downloadBase64Image(newReportPath,base64)
});
}
//导出-png图片
const ExportReportPNG= async function() {const mapImg = await mapReport.map.expImage({download: false}) //必须要有这一行才能显示地图图片var reportBody = document.getElementById("reportBody"); html2canvas(reportBody, { allowTaint: true, useCORS: true,}).then(divImgCanvas=>{const base64 = divImgCanvas.toDataURL("image/png")let newReportPath=dkinfo.dkmc + "_审查报告.png"; mars3d.Util.downloadBase64Image(newReportPath,base64) }); }