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