使用Spire Presentation API保存图像时,GDI +中发生了一般错误

时间:2015-05-13 11:14:04

标签: c# powerpoint

我正在使用Spire Presentation API将PowerPoint幻灯片转换为图像,但在保存图像时“GDI +中发生了一般错误”。抛出异常。我无法克服任何想法来克服这个例外。

以下是我的代码:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;
using Spire.Presentation;
using Spire.Presentation.Drawing;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
       {
          Presentation presentation = new Presentation();
          presentation.LoadFromFile("d:\\slide.pptx");
          System.Drawing.Image image=presentation.Slides[0].SaveAsImage();
          string fileName = String.Format("slider1.png", 0);
          image.Save(fileName, System.Drawing.Imaging.ImageFormat.Png);
          System.Diagnostics.Process.Start(fileName);
       }
}

执行期间

image.Save(fileName, System.Drawing.Imaging.ImageFormat.Png);
执行

然后抛出“GDI +中发生一般错误”异常

0 个答案:

没有答案