STP-Zeichnungen
Contents
[
Hide
]Exportieren des STP-Formats nach PNG
Aspose.CAD für JavaScript in Angular ermöglicht Entwicklern, eine STP Datei in das PNG-Format zu exportieren. Der Ansatz zur Konvertierung von STP nach PNG funktioniert wie folgt:
- Laden Sie die STP Zeichnungsdatei mithilfe der Methode Image.load.
- Rufen Sie Image.save auf, während Sie als zweiten Parameter ein Objekt von PngOptions übergeben.
Beispielcode
Der folgende Code zeigt, wie Sie dasselbe Ziel mit Aspose.CAD für JavaScript erreichen können
This file contains 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.stp | |
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' }); | |
}); | |
} |