Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Last active December 23, 2021 06:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aspose-com-gists/168ae56215fcc24740a532012f9a71c8 to your computer and use it in GitHub Desktop.
Save aspose-com-gists/168ae56215fcc24740a532012f9a71c8 to your computer and use it in GitHub Desktop.
Convert EPS Postscript File to TIFF, EMF, or WMF Image Programmatically using C#
// create a stream for input EPS file
using (var psStream = new System.IO.FileStream("Sample.eps", System.IO.FileMode.Create, System.IO.FileAccess.Read))
{
// create a stream for output EMF file
using (var pdfStream = System.IO.File.Open("output.emf", System.IO.FileMode.Open, System.IO.FileAccess.Write))
{
// load the EPS file from stream
var document = new Aspose.Page.EPS.PsDocument(psStream);
// create an instance of ImageSaveOptions
var options = new Aspose.Page.EPS.Device.ImageSaveOptions();
// create rendering device for EMF
var device = new Aspose.Page.EPS.Device.ImageDevice(System.Drawing.Imaging.ImageFormat.Emf);
// Convert EPS to EMF Image
document.Save(device, options);
}
}
// create a stream for input EPS file
using (var epsStream = new FileStream("Sample.eps", FileMode.Create, FileAccess.Read))
{
// create a stream for output TIFF file
using (var tiffStream = File.Open("output.tiff", FileMode.Open, FileAccess.Write))
{
// load the EPS file from stream
var document = new Aspose.Page.EPS.PsDocument(epsStream);
// create an instance of ImageSaveOptions
var options = new Aspose.Page.EPS.Device.ImageSaveOptions();
// create rendering device for TIFF
var device = new Aspose.Page.EPS.Device.ImageDevice(System.Drawing.Imaging.ImageFormat.Tiff);
// Convert EPS to TIFF Image
document.Save(device, options);
}
}
// create a stream for input EPS file
using (var psStream = new System.IO.FileStream("Sample.eps", System.IO.FileMode.Create, System.IO.FileAccess.Read))
{
// create a stream for output WMF file
using (var pdfStream = System.IO.File.Open("output.wmf", System.IO.FileMode.Open, System.IO.FileAccess.Write))
{
// load the EPS file from stream
var document = new Aspose.Page.EPS.PsDocument(psStream);
// create an instance of ImageSaveOptions
var options = new Aspose.Page.EPS.Device.ImageSaveOptions();
// create rendering device for WMF
var device = new Aspose.Page.EPS.Device.ImageDevice(System.Drawing.Imaging.ImageFormat.Wmf);
// Convert EPS to WMF Image
document.Save(device, options);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment