For more details, please visit Convert EPS or PS PostScript File to a DOCX or DOC Word Document in C#
Last active
July 4, 2024 03:34
-
-
Save aspose-com-gists/4e8416244fdc6ab37e9ca6bc241c7ae6 to your computer and use it in GitHub Desktop.
Convert EPS or PS PostScript File to a DOCX or DOC Word Document in C# .NET Programmatically
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
// Declare MemoryStream to save intermediary PDF document. | |
MemoryStream pdfStream = new MemoryStream(); | |
// Initialize PsDocument with PostScript file. | |
Aspose.Page.EPS.PsDocument document = new Aspose.Page.EPS.PsDocument("input.ps"); | |
// If you want to convert Postscript file despite of minor errors set this flag | |
bool suppressErrors = true; | |
// Initialize PdfSaveOptions object with necessary parameters. | |
Aspose.Page.EPS.Device.PdfSaveOptions options = new Aspose.Page.EPS.Device.PdfSaveOptions(suppressErrors); | |
options.JpegQualityLevel = 100; | |
// If you want to add special folder where fonts are stored. Default fonts folder in OS is always included. | |
//options.AdditionalFontsFolders = (new String [] {"FONTS_FOLDER"}); | |
// Convert EPS or PS Postscript file to PDF stream | |
document.SaveAsPdf(pdfStream, options); | |
// Load the intermediary PDF file | |
Document doc = new Document(pdfStream); | |
// Instantiate an object of DocSaveOptions | |
DocSaveOptions saveOptions = new DocSaveOptions(); | |
// Set output document format as DOCX or DOC | |
saveOptions.Format = DocSaveOptions.DocFormat.DocX; | |
// Convert the EPS or PS file to a Word DOCX or DOC file | |
doc.Save("output.docx", saveOptions); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment