Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Last active September 26, 2025 13:46
Show Gist options
  • Save aspose-com-gists/f960472c55595d3aa0abedc07161dd31 to your computer and use it in GitHub Desktop.
Save aspose-com-gists/f960472c55595d3aa0abedc07161dd31 to your computer and use it in GitHub Desktop.
Merge PS/EPS to PDF with .NET

Merge PS Examples

These snippets demonstrate merging multiple PostScript (PS) and EPS files into a single PDF document using Aspose.Page for .NET.

Key Use Cases

  • Merge several PS/EPS files into one PDF document

How to Run Examples

  1. Reference Aspose.Page for .NET: Aspose.Page on Windows; Aspose.Page.Drawing on non‑Windows.
  2. Copy a snippet into your project.
  3. Apply a temporary license as described in the licensing guide.
  4. Build and run.

Restrictions

In evaluation mode, the total length of merged PS/EPS files is limited to 1Mb. Apply a valid license to use the full functionality.

Related Documentation

More about PS/EPS merging is placed in Merge PostScript files to PDF using .NET and Merge EPS files to PDF using .NET chapters of the official documentation.

Related Resources

Requirements

  • .NET 6.0+, .NET Core, or .NET Framework
  • Aspose.Page for .NET library
Aspose.Page for .NET – Merge PS Examples
// Merge several EPS files to one PDF document.
// Learn more: https://docs.aspose.com/page/net/merge/ps/
// Initialize PS document with the first EPS file
PsDocument document = new PsDocument(DataDir + "input.eps");
// Create an array of PostScript files that will be merged with the first one
string[] filesForMerge = new string[] { DataDir + "input2.eps", DataDir + "input3.eps" };
// If you want to convert Postscript file despite of minor errors set this flag
bool suppressErrors = true;
//Initialize options object with necessary parameters.
PdfSaveOptions options = new PdfSaveOptions(suppressErrors);
// If you want to add special folder where fonts are stored. Default fonts folder in OS is always included.
options.AdditionalFontsFolders = new string[] { @"{FONT_FOLDER}" };
// Default page size is 595x842 and it is not mandatory to set it in SaveOptions
// But if you need to specify the page size following line
//PdfSaveOptions options = new PdfSaveOptions(suppressErrors, new Aspose.Page.Drawing.Size(595, 842));
document.MergeToPdf(OutputDir + "outputPDF_out.pdf", filesForMerge, options);
//Review errors
if (suppressErrors)
{
foreach (Exception ex in options.Exceptions)
{
Console.WriteLine(ex.Message);
}
}
// Merge several PS files to one PDF document.
// Learn more: https://docs.aspose.com/page/net/merge/ps/
// Initialize PS document with the first PostScript file
PsDocument document = new PsDocument(DataDir + "input.ps");
// Create an array of PostScript files that will be merged with the first one
string[] filesForMerge = new string[] { DataDir + "input2.ps", DataDir + "input3.ps" };
// If you want to convert Postscript file despite of minor errors set this flag
bool suppressErrors = true;
//Initialize options object with necessary parameters.
PdfSaveOptions options = new PdfSaveOptions(suppressErrors);
// If you want to add special folder where fonts are stored. Default fonts folder in OS is always included.
options.AdditionalFontsFolders = new string[] { @"{FONT_FOLDER}" };
// Default page size is 595x842 and it is not mandatory to set it in SaveOptions
// But if you need to specify the page size following line
//PdfSaveOptions options = new PdfSaveOptions(suppressErrors, new Aspose.Page.Drawing.Size(595, 842));
document.MergeToPdf(OutputDir + "outputPDF_out.pdf", filesForMerge, options);
//Review errors
if (suppressErrors)
{
foreach (Exception ex in options.Exceptions)
{
Console.WriteLine(ex.Message);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment