Image export failed

Hi,
I am trying to create pdf using .eps but it is throwing an exception - Image export failed, Can you please look into this.

  int height = 200;
  int width = 200;
  string pdfFile = @"C:\Output.pdf";
  
  using (var img = Aspose.Imaging.Image.Load(@"C:\2023-08-14326B-extended_data_figure1.eps"))
  {
    height += img.Height;
    width += img.Width;
  }

  var pdf = new Document();
  var pdfImageSection = pdf.Pages.Add();
  pdfImageSection.PageInfo.Width = width;
  pdfImageSection.PageInfo.Height = height;
  pdfImageSection.PageInfo.Margin.Bottom = 50;
  pdfImageSection.PageInfo.Margin.Top = 50;
  pdfImageSection.PageInfo.Margin.Right = 50;
  pdfImageSection.PageInfo.Margin.Left = 50;

  FileStream stream = new FileStream(filePath, FileMode.Open);
  var image = new Image { ImageStream = stream };

  pdfImageSection.Paragraphs.Add(image);
  pdf.Save(pdfFile);

2023-08-14326B-extended_data_figure1.zip (18.2 KB)

Version - Aspose.PDF.Drawing (23.10.1)

@amolm

EPS is not an image type. In order to convert EPS to PDF, you need to use below code snippet:

string inFile = dataDir + "input.eps";
string outFile = dataDir + "PdfToPostScript_out.pdf";

Document doc = new Document(inFile, new PsLoadOptions() { FontsFolders = new[] { "C:\\Windows\\Fonts" } });
doc.Save(outFile);