DWFx 绘图
Contents
[
Hide
]将 DWFX 格式导出为 PNG
Aspose.CAD for Javascript in Angular 允许开发人员将 DWFX 文件导出为 PNG 格式。 DWFX 到 PNG 的转换方法如下:
- 使用 Image.load 方法加载 DWFX 绘图文件。
- 在调用 Image.save 时,将 PngOptions 对象作为第二个参数传递。
示例代码
以下代码演示了如何使用 Aspose.CAD for JavaScript 实现相同的目标。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async onFileSelected(event) { | |
const file: File = event.target.files[0]; //file.dwfx | |
file.arrayBuffer().then(async buff => { | |
let x = new Uint8Array(buff); | |
this.imgFile = await Image.load(x); | |
var exportedFile = await Image.save(this.imgFile, new PngOptions()); | |
var blob = new Blob([exportedFile], { type: 'application/octet-stream' }); | |
}); | |
} |