STL Drawings
Contents
[
Hide
]Exporting STL Format To PNG
Aspose.CAD for Javascript in Angular allows developers to export an STL file to PNG format. STL to PNG conversion approach works as follows:
- Load STL drawing file using the Image.load method.
- Call Image.save while passing an object of PngOptions as the second parameter.
Sample Code
The code below shows how to achieve the same goal using Aspose.CAD for JavaScript
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.stl | |
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' }); | |
}); | |
} |