SVG Drawings
Contents
[
Hide
]صادرات فرمت SVG به PDF
Aspose.CAD برای .NET به توسعهدهندگان اجازه میدهد تا یک فایل SVG را به فرمت PDF صادر کنند. روش تبدیل SVG به PDF به شکل زیر عمل میکند:
- فایل طراحی SVG را با استفاده از روش کارخانه Image.Load بارگذاری کنید.
- یک شیء از کلاس CadRasterizationOptions بسازید و properties PageHeight و PageWidth را تنظیم کنید.
- یک شیء از کلاس PdfOptions بسازید و property 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); | |
} |