C#使用Aspose.Words把 word转成图片

///文件分页保存成图片

csharp 复制代码
Document doc = new Document("f:\\333.doc");
ImageSaveOptions iso = new ImageSaveOptions(SaveFormat.Jpeg);
            iso.Resolution = 128;//这个数据越大越好 清晰度
            iso.PrettyFormat = true;
            iso.UseAntiAliasing = true;///抗锯齿
            for (int i = 0; i < doc.PageCount; i++)
            {
                iso.PageIndex = i;
                doc.Save("D:/test/test" + i + ".jpg", iso);
            }

//文件处理完成后,保存字节流保存图片

csharp 复制代码
 doc = new Document(GModel.PrintBiaoqianPath);
  doc = new OPWord().ObjectToBookmark<PrintBiaoqian>(doc, ThisModel);
  //string TempFilepath = GModel.FileTempExport + ReportOut.LeixingName + Guid.NewGuid().ToString().Substring(0, 3) + ".Temp";
  MemoryStream WordStream = new MemoryStream();
  WordStream.Seek(0, SeekOrigin.Begin);
  ImageSaveOptions options = new ImageSaveOptions(SaveFormat.Png); 
  options.MemoryOptimization = true;
  options.Resolution = 250;
  options.PrettyFormat = true;
  options.UseAntiAliasing = true;
  doc.Save(WordStream, options);
  Image ThisImage = new Bitmap(WordStream);
  if (ThisImage!=null )
  {
      PBShow.Image =  ThisImage;
  } 
相关推荐
一颗小青松3 小时前
uniapp 集成友盟并且上传页面路径
前端·vue.js·uni-app
周淳APP4 小时前
微前端核心沙箱机制深度解析:从iframe到乾坤沙箱
前端·学习·iframe·微前端·qiankun·前端架构
SenChien4 小时前
C#学习笔记-入门篇
笔记·学习·c#·rider
JarvanMo4 小时前
Android View 相关工具包终于成为了历史
前端
Xin_ye100864 小时前
C# 零基础到精通教程 - 第九章:面向对象编程(高级)——接口、委托与事件
开发语言·c#
步步为营DotNet4 小时前
深入.NET 11:C# 14 在边缘计算数据处理的优化与实践
c#·.net·边缘计算
2501_940041744 小时前
应用构建:前端复杂交互与数据可视化的进阶之路
前端·信息可视化
前端若水4 小时前
项目初始化:Vite + React + shadcn/ui
前端·react.js·ui
ZC跨境爬虫4 小时前
模块化烹饪小程序开发日记 Day4:网络层基础设施与接口治理实践
前端·javascript·数据库·ui·html
冴羽yayujs4 小时前
快速夯实 JavaScrilpt 基础的 33 个概念
前端·javascript·github·前端开发