You can read more details at: Convert EPS or PS to SVG in C#
Last active
March 16, 2022 08:19
-
-
Save aspose-com-gists/44dac282b63a6fd1d7c01da8a6e8784c to your computer and use it in GitHub Desktop.
Convert EPS or PS to SVG in C# | Postscript to SVG Image in .NET
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
// Initialize a MemoryStream class object | |
Stream stream = new MemoryStream(); | |
// Initialize PostScript input stream | |
System.IO.FileStream psStream = new System.IO.FileStream("input.eps", System.IO.FileMode.Open, System.IO.FileAccess.Read); | |
Aspose.Page.EPS.PsDocument document = new Aspose.Page.EPS.PsDocument(psStream); | |
// If you want to convert Postscript file despite of minor errors set this flag | |
bool suppressErrors = true; | |
// Initialize options object with necessary parameters. | |
Aspose.Page.EPS.Device.PdfSaveOptions options = new Aspose.Page.EPS.Device.PdfSaveOptions(suppressErrors); | |
// Initialize a PdfDevice class object | |
Aspose.Page.EPS.Device.PdfDevice device = new Aspose.Page.EPS.Device.PdfDevice(stream, new System.Drawing.Size(595, 842)); | |
// Convert the EPS file to PDF format | |
document.Save(device, options); | |
// Load the intermediary PDF document | |
Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(stream); | |
// Instantiate an object of SvgSaveOptions class | |
Aspose.Pdf.SvgSaveOptions saveOptions = new Aspose.Pdf.SvgSaveOptions(); | |
// Save the output file as SVG image | |
pdfDocument.Save("output.svg", saveOptions); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment