ציורים ב-SVG
Contents
[
Hide
]ייצוא פורמט SVG ל-PDF
Aspose.CAD עבור .NET מאפשר ל developers לייצא קובץ SVG לפורמט PDF. גישת ההמרה מ-SVG ל-PDF פועלת כך:
- טען את קובץ הציור SVG באמצעות שיטת ה-factory Image.Load.
- צור אובייקט של המחלקה CadRasterizationOptions והגדר את המאפיינים PageHeight ו-PageWidth.
- צור אובייקט של המחלקה PdfOptions והגדר את המאפיין VectorRasterizationOptions.
- קרא ל-Image.Save תוך כדי העברת אובייקט של PdfOptions כפרמטר השני.
קוד לדוגמה
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.svg"; | |
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 SVG to PDF | |
string outPath = "output.pdf"; | |
image.Save(outPath, options); | |
} |