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;
  } 
相关推荐
JudithHuang3 小时前
React 嵌套路由与布局
前端·react.js·arcgis·react·react router
htzyl2063 小时前
前端阶梯——第四十三章、实战二:待办清单To-Do
前端·javascript·html
WarPigs3 小时前
C#把byte[]以十六进制打印,带分割符
c#
摹客4 小时前
【3D设计】界面设计中的3D元素:应用场景+5款工具横评(含Three.js)
前端
Hilaku4 小时前
CORS 到底在保护谁?90% 的前端理解错了跨域的本质
前端·javascript·程序员
wno7044 小时前
node.js中使用jquery
前端·node.js·jquery
暴走约伯4 小时前
【VFX工具链源码拆解 04】拯救丢失的绑定:Timeline 一键克隆与层级相对路径重映射算法
unity·c#·游戏引擎·硬件工程
阿琳a_4 小时前
b-map-viewer:面向 Vue 3 的地图可视化 SDK,从接入到展示再到交互分析
前端·javascript·vue.js·gis·数据可视化·地图
1-1=05 小时前
C# 反射
c#·.net·.netcore