【问题标题】:SVG not appearing in screenshotSVG 未出现在屏幕截图中
【发布时间】:2019-09-05 08:23:00
【问题描述】:

我已经按照这里的教程:https://forge.autodesk.com/blog/create-pushpin-markup-svg

我已经成功地将 svg 图像实现为我的查看器的一部分,将它们绑定到查看器事件的重绘等。但随后我开始使用查看器的屏幕截图功能。这导致获得没有 svg 标记的屏幕截图。

但是,诸如线条之类的标记在添加到叠加层(叠加场景)时仍然有效。

有没有办法将 svg 图像添加到查看器叠加层,以便可以将它们导出到屏幕截图中,或者有其他方法可以实现吗?

【问题讨论】:

    标签: autodesk-forge autodesk-viewer


    【解决方案1】:

    一种可能的解决方法是使用canvg library 在拍摄后将svg 绘制到镜头(通过屏幕到画布渲染库,例如html2canvas 等):

    html2canvas(viewer.canvas).then(canvas => {
        canvas.getContext('2d').drawSvg(SVG_XML_OR_PATH) //draw the markups here with the extension enabled by "canvg"
        canvas.toDataURL/toBlob ... //persist your capture
    
    });
    

    【讨论】:

    • 有没有办法将 SVG 图像添加到场景中?
    猜你喜欢
    • 2011-08-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-05
    • 1970-01-01
    • 2016-10-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多