IGES 图纸
Contents
[
Hide
]导出 IGES 格式为 PNG
Aspose.CAD for Javascript in Angular 允许开发者将 IGES 文件导出为 PNG 格式。 IGES 到 PNG 转换方法如下:
- 使用 Image.load 方法加载 IGES 图纸文件。
- 调用 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.igs | |
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' }); | |
}); | |
} |