الرسومات SVG
Contents
[
Hide
]تصدير تنسيق SVG إلى PDF
يتيح Aspose.CAD لمطوري .NET تصدير ملف SVG إلى PDF بتنسيق. تعمل طريقة تحويل SVG إلى PDF كما يلي:
- تحميل ملف رسم SVG باستخدام طريقة المصنع 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); | |
} |