Bản vẽ DXF
Contents
[
Hide
]Xuất định dạng DXF sang PNG
Aspose.CAD cho Javascript trong Angular cho phép các nhà phát triển xuất một tệp DXF sang định dạng PNG. Phương pháp chuyển đổi từ DXF sang PNG hoạt động như sau:
- Tải tệp bản vẽ DXF bằng cách sử dụng phương thức Image.load.
- Gọi Image.save trong khi truyền một đối tượng của PngOptions làm tham số thứ hai.
Mã mẫu
Mã dưới đây cho thấy cách đạt được mục tiêu tương tự bằng cách sử dụng Aspose.CAD cho 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.dxf | |
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' }); | |
}); | |
} |