DGN図面
Contents
[
Hide
]DGNフォーマットをPNGにエクスポートする
Aspose.CAD for Javascript in Angularは、開発者がDGNファイルをPNGフォーマットにエクスポートすることを可能にします。 DGNからPNGへの変換方法は次のように機能します:
- Image.loadメソッドを使用してDGN図面ファイルを読み込みます。
- PngOptionsのオブジェクトを第二引数として渡しながらImage.saveを呼び出します。
サンプルコード
以下のコードは、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.dgn | |
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' }); | |
}); | |
} |