แบบภาพ STP
Contents
[
Hide
]การส่งออกฟอร์แมต STP เป็น PDF
Aspose.CAD สำหรับ .NET ช่วยให้นักพัฒนาสามารถส่งออกไฟล์ STP เป็นฟอร์แมต PDF วิธีการแปลง STP เป็น PDF ทำงานดังต่อไปนี้:
- โหลดไฟล์ภาพวาด STP โดยใช้เมธอดโรงงาน Image.Load.
- สร้างอ็อบเจ็กต์ของคลาส CadRasterizationOptions และตั้งค่าคุณสมบัติ PageHeight & PageWidth.
- สร้างอ็อบเจ็กต์ของคลาส PdfOptions และตั้งค่าคุณสมบัติ VectorRasterizationOptions.
- เรียกใช้ Image.Save ขณะที่ส่งอ็อบเจ็กต์ของ PdfOptions เป็นพารามิเตอร์ที่สอง.
Sample Code
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
string inputFile ="file.stp"; | |
using (Image image = Image.Load(inputFile)) | |
{ | |
// Initialize PdfOptions class object | |
PdfOptions options = new PdfOptions(); | |
CadRasterizationOptions cadRasterizationOptions = new CadRasterizationOptions(); | |
cadRasterizationOptions.PageHeight = 500; | |
cadRasterizationOptions.PageWidth = 500; | |
options.VectorRasterizationOptions = cadRasterizationOptions; | |
// Export STP to PDF | |
string outPath = "output.pdf"; | |
image.Save(outPath, options); | |
} |