نقاشیهای DXF
Contents
[
Hide
]صادرات فرمت DXF به PNG
Aspose.CAD برای جاوا اسکریپت در انگولار به توسعهدهندگان اجازه میدهد تا یک فایل DXF را به فرمت PNG صادر کنند. رویکرد تبدیل DXF به PNG به صورت زیر عمل میکند:
- فایل نقاشی DXF را با استفاده از متد Image.load بارگذاری کنید.
- متد Image.save را فراخوانی کنید و یک شی از PngOptions را به عنوان پارامتر دوم ارسال کنید.
کد نمونه
کد زیر نشان میدهد چگونه به هدف مشابهی با استفاده از Aspose.CAD برای جاوا اسکریپت دست یابید.
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' }); | |
}); | |
} |