การวาดภาพ CF2
Contents
[
Hide
]การส่งออกฟอร์แมต CF2 ไปเป็น PNG
Aspose.CAD สำหรับ Javascript ใน Angular อนุญาตให้นักพัฒนาสามารถส่งออกไฟล์ CF2 ไปเป็นฟอร์แมต PNG ได้ วิธีการแปลง CF2 เป็น PNG ทำงานดังนี้:
- โหลดไฟล์วาดภาพ CF2 โดยใช้วิธี Image.load
- เรียก Image.save พร้อมกับส่งผ่านวัตถุของ PngOptions เป็นพารามิเตอร์ที่สอง
ตัวอย่างโค้ด
โค้ดด้านล่างแสดงวิธีการทำเป้าหมายเดียวกันโดยใช้ Aspose.CAD สำหรับ 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.cf2 | |
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' }); | |
}); | |
} | |