SVG 文件是常用的,因为它们可以在不损失图像质量的情况下进行缩放。您可以使用 C# 以编程方式将SVG文件转换为EPS或PS Postscript 文件。
SVG 文件是常用的,因为它们可以在不损失图像质量的情况下进行缩放。您可以使用 C# 以编程方式将SVG文件转换为EPS或PS Postscript 文件。您可以在以下部分中探索有关转换的深入信息:
- SVG 到 EPS 或 PS PostScript 文件转换器 – C# .NET API 安装
- 使用 C# 以编程方式将 SVG 转换为 EPS 或 PS PostScript 文件

SVG 到 EPS 或 PS PostScript 文件转换器 – C# .NET API 安装
SVG 到 EPS 或 PS 的转换是一个两步过程。首先将 SVG 图像渲染为 PDF 格式,然后将 PDF 文件转换为 EPS 或 PS PostScript 格式。因此,请从New Releases下载Aspose.SVG for .NET和 Aspose.PDF for .NET API的 DLL 文件,或使用以下 NuGet 安装命令:
PM> Install-Package Aspose.SVG
PM> Install-Package Aspose.PDF
使用 C# 以编程方式将 SVG 转换为 EPS 或 PS PostScript 文件
您可以通过以下步骤将 SVG 图像转换为 EPS 或 PS PostScript 文件:
- 初始化一个MemoryStream对象。
- 使用SVGDocument类加载输入 SVG 文件。
- 初始化PdfRenderingOptions类的实例。
- 使用PdfDevice 将SVG 渲染为 PDF 文件。
- 指定打印机和页面设置。
- 将 SVG 转换为 EPS 或 PS 文件。
以下代码解释了如何使用 C# 以编程方式将 SVG 文件转换为 EPS 或 PS 文件:
// Initialize a MemoryStream objectMemoryStream stream = new MemoryStream();// Initialize an SVG document from a fileSVGDocument document = new SVGDocument("light.svg");// Initialize an instance of PdfRenderingOptions classPdfRenderingOptions pdfRenderingOptions = new PdfRenderingOptions();pdfRenderingOptions.PageSetup.AnyPage = new Page(new Size(500, 500), new Margin(10, 10, 10, 10));// Initialize an instance of PdfDevice classIDevice device = new PdfDevice(pdfRenderingOptions, stream); // Render SVG to PDF, send the document to the rendering devicedocument.RenderTo(device);String printerName = "Microsoft XPS Document Writer";String psOutFileName = "psOut.ps";Document pdf = new Document(stream);// Create the printer settingsPrinterSettings printerSettings = new PrinterSettings();printerSettings.PrinterName = (printerName);printerSettings.PrintToFile = (true);printerSettings.PrintFileName = (dataDir + psOutFileName);// Specify page settingsPageSettings pageSettings = new PageSettings();pageSettings = printerSettings.DefaultPageSettings;pageSettings.Margins = (new Margins(0, 0, 0, 0));pageSettings.Color = (true);PdfViewer viewer = new PdfViewer();viewer.BindPdf(pdf);viewer.AutoResize = (true);viewer.AutoRotate = (true);viewer.PrintPageDialog = (false);// Convert the SVG to EPS or PS fileviewer.PrintDocumentWithSettings(pageSettings, printerSettings);
如果你想试用Aspose的全部完整功能,可联系在线客服获取30天临时授权体验。
还想要更多吗可以点击阅读【Aspose最新资源在线文库】,查找需要的教程资源。如果您有任何疑问或需求,请随时加入Aspose技术交流群(),我们很高兴为您提供查询和咨询。
标签:
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!