文档转图片

1.使用NuGet添加 Spire.Doc

2.使用方式

Document document = new Document();

document.LoadFromFile(documentPath);

//参数解释为 pageIndex, pageCount, ImageType

Image[] image = document.SaveToImages(0, document.PageCount, ImageType.Metafile);

//可通过循环 image数组将图片保存到指定位置

//实例代码

for (int i = 0; i < image.Length; i++)
{

  //保存路径,保存的图片格式
  image[i].Save(path, System.Drawing.Imaging.ImageFormat.Png);

}

 

posted @ 2019-05-21 21:16  xiewei123  阅读(232)  评论(0编辑  收藏  举报