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;
  } 
相关推荐
紫禁玄科6 小时前
Shai-Hulud:npm生态的自我复制蠕虫风暴
前端·npm·node.js
东风破_6 小时前
后端API没写好,前端难道干等着吗?
前端
用户938515635076 小时前
从前后端分离到前端接口工程:React + MockJS + Vite 解析
前端·后端·全栈
用户938515635076 小时前
从零在浏览器里跑 DeepSeek-R1:WebGPU + Transformers.js 全链路实战(三)
前端·react.js·typescript
excel6 小时前
当前端行情变差,我们为什么还要坚持?
前端
鸿是江边鸟,曾是心上人7 小时前
快速搭建HTTPS本地开发环境
前端
椒颜皮皮虾྅7 小时前
OpenVINO C# API 3.3.1:支持OpenVINO 2026.3及GenAI增强
人工智能·c#·openvino
To_OC8 小时前
写了 5 个表单 Demo 后,我终于彻底搞懂了 React 受控与非受控组件
前端·react.js·前端框架
Sterting8 小时前
第9课 Vue Router 路由
前端·vue.js
用户059540174468 小时前
LangChain Memory 测试踩坑实录:用 pytest 自动化回归对话记忆,我折腾了整整一个周末
前端·css