Disegni DWG
Contents
[
Hide
]Esportare il formato DWG in PNG
Aspose.CAD per Javascript in Angular consente ai programmatori di esportare un file DWG nel formato PNG. L’approccio di conversione da DWG a PNG funziona nel seguente modo:
- Carica il file di disegno DWG utilizzando il metodo Image.load.
- Chiama Image.save passando un oggetto di PngOptions come secondo parametro.
Codice di esempio
Il codice sottostante mostra come raggiungere lo stesso obiettivo utilizzando Aspose.CAD per 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.dwg | |
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' }); | |
}); | |
} |