@asad.ali
Hello. i am trying to convert EPS to TIF. Eps file is attached.
Sample Code:
var epsFileName = BasicHelpers.GetFileNameFromPath(epsFilePath);
// Initialize PostScript input stream
FileStream psStream = new FileStream(epsFilePath, FileMode.Open, FileAccess.Read);
PsDocument document = new 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.
ImageSaveOptions options = new ImageSaveOptions(suppressErrors);
options.JpegQualityLevel = 100;
ImageFormat imageFormat = ImageFormat.Tiff;
// Default image size is 595x842 and it is not mandatory to set it in ImageDevice
var imageSize = new Size() { Height = 400, Width = 300 };
ImageDevice device = new ImageDevice(imageSize, imageFormat);
try
{
document.Save(device, options);
}
finally
{
psStream.Close();
}
// For every page an image bytes array will be obtained where number of byte arrays equals to the number of pages
// in input PS file.
byte[][] imagesBytes = device.ImagesBytes;
int i = 0;
foreach (byte[] imageBytes in imagesBytes)
{
string imagePath = Path.GetFullPath(writeFolderPath + "\\" + epsFileName + i.ToString() + "." + imageFormat.ToString());
using (FileStream fs = new FileStream(imagePath, FileMode.Create, FileAccess.Write))
{
fs.Write(imageBytes, 0, imageBytes.Length);
}
i++;
}
ILL-000351496.zip (124.3 KB)