我正在使用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 +中发生一般错误”异常