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;
  } 
相关推荐
用户693717500138425 分钟前
Google 正在“收紧侧加载”:陌生 APK 安装或需等待 24 小时
android·前端
蓝帆傲亦30 分钟前
Web 前端搜索文字高亮实现方法汇总
前端
用户693717500138430 分钟前
Room 3.0:这次不是升级,是重来
android·前端·google
似水明俊德2 小时前
02-C#.Net-反射-面试题
开发语言·面试·职场和发展·c#·.net
漫随流水2 小时前
旅游推荐系统(view.py)
前端·数据库·python·旅游
踩着两条虫3 小时前
VTJ.PRO 核心架构全公开!从设计稿到代码,揭秘AI智能体如何“听懂人话”
前端·vue.js·ai编程
阿蒙Amon3 小时前
C#常用类库-详解SerialPort
开发语言·c#
jzlhll1234 小时前
kotlin Flow first() last()总结
开发语言·前端·kotlin
似水明俊德5 小时前
02-C#.Net-反射-学习笔记
开发语言·笔记·学习·c#·.net
蓝冰凌5 小时前
Vue 3 中 defineExpose 的行为【defineExpose暴露ref变量】详解:自动解包、响应性与实际使用
前端·javascript·vue.js