资源简介
该项目中包含Aspose.words破解版DLL,以及微软官方的office的插件,测试项目代码。
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing.Imaging;
using Aspose.Words;
using System.IO;
using Aspose.Words.Saving;
namespace Aspose.Word2Image
{
class Program
{
///
/// 将Word文档转换为图片的方法(该方法基于第三方DLL),你可以像这样调用该方法:
/// ConvertPDF2Image(“F:\\PdfFile.doc“ “F:\\“ “ImageFile“ 1 20 ImageFormat.Png 256);
///
/// Word文件路径
/// 图片输出路径,如果为空,默认值为Word所在路径
/// 图片的名字,不需要带扩展名,如果为空,默认值为Word的名称
/// 从PDF文档的第几页开始转换,如果为0,默认值为1
/// 从PDF文档的第几页开始停止转换,如果为0,默认值为Word总页数
/// 设置所需图片格式,如果为null,默认格式为PNG
/// 设置图片的像素,数字越大越清晰,如果为0,默认值为128,建议最大值不要超过1024
public static void ConvertWordToImage(string wordInputPath string imageOutputPath
string imageName int startPageNum int endPageNum ImageFormat imageFormat float resolution)
{
try
{
// open word file
Aspose.Words.Document doc = new Aspose.Words.Document(wordInputPath);
// validate parameter
if (doc == null) { throw new Exception(“Word文件无效或者Word文件被加密!“); }
if (imageOutputPath.Trim().Length == 0) { imageOutputPath = Path.GetDirectoryName(wordInputPath); }
if (!Directory.Exists(imageOutputPath)) { Directory.CreateDirectory(imageOutputPath); }
if (imageName.Trim().Length == 0) { imageName = Path.GetFileNameWithoutExtension(wordInputPath); }
if (startPageNum <= 0) { startPageNum = 1; }
if (endPageNum > doc.PageCount || endPageNum <= 0) { endPageNum = doc.PageCount; }
if (startPageNum > endPageNum) { int tempPageNum = startPageNum; startPageNum = endPageNum; endPageNum = startPageNum; }
if (imageFormat == null) { imageFormat = ImageFormat.Png; }
if (resolution <= 0) { resolution = 128; }
ImageSaveOptions imageSaveOptions = new ImageSaveOptions(GetSaveFormat(imageFormat));
imageSaveOptions.Resolution = resolution;
// start to convert each page
for (int i = startPageNum; i <= endPageNum; i++)
{
imageSaveOptions.PageIndex = i - 1;
doc.Save(Path.Combine(imageOutputPath imageName) + “_“ + i.ToString() + “.“ + imageFormat.ToString() imageSaveOptions);
}
}
catch (Exception ex)
{
throw ex;
}
}
private static SaveFormat GetSaveFormat(ImageFormat imageFormat)
{
SaveFormat sf = SaveFormat.
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2012-02-22 19:07 WORD2IMAGE\
目录 0 2012-02-22 19:06 WORD2IMAGE\Aspose.word2image\
文件 2856 2012-02-22 19:03 WORD2IMAGE\Aspose.word2image\Aspose.word2image.csproj
文件 4021 2012-02-22 19:05 WORD2IMAGE\Aspose.word2image\Program.cs
目录 0 2012-02-22 11:28 WORD2IMAGE\Aspose.word2image\Properties\
文件 1378 2012-02-22 11:28 WORD2IMAGE\Aspose.word2image\Properties\AssemblyInfo.cs
目录 0 2012-02-22 19:11 WORD2IMAGE\Microsoft.word2pdf\
文件 2636 2012-02-22 19:09 WORD2IMAGE\Microsoft.word2pdf\Microsoft.word2pdf.csproj
文件 4826 2012-02-22 19:09 WORD2IMAGE\Microsoft.word2pdf\Program.cs
目录 0 2012-02-22 19:07 WORD2IMAGE\Microsoft.word2pdf\Properties\
文件 1380 2012-02-22 19:07 WORD2IMAGE\Microsoft.word2pdf\Properties\AssemblyInfo.cs
文件 1449 2012-02-22 19:08 WORD2IMAGE\WORD2IMAGE.sln
文件 13312 2012-02-22 19:10 WORD2IMAGE\WORD2IMAGE.suo
目录 0 2012-02-22 19:11 WORD2IMAGE\_dll\
文件 6597120 2011-10-12 12:49 WORD2IMAGE\_dll\Aspose.Words.dll
文件 781104 2007-10-10 09:49 WORD2IMAGE\_dll\Microsoft.Office.Interop.Word.dll
目录 0 2012-02-22 19:11 WORD2IMAGE\_reference\
文件 955112 2012-02-19 20:01 WORD2IMAGE\_reference\SaveAsPDFandXPS.exe
相关资源
- Programming Pearls Second Edition(编程珠玑
- 树莓派Raspberry+Pi实战指南 手把手教你
- 爱上Raspberry Pi 中文完整版 pdf
- Aspose.Words根据word模板写入数据和图表
- Aspose Excel Word PPT PDF .dll
-
me
tasploit渗透测试指南(中文完整清 -
精通me
tasploit渗透测试 高清文字版带 - jasperreport 生成pdf实现与打印
- 树莓派(Raspberry+Pi)实战指南 手把手
- 41980468KrisKaspersky:Shellcoder编程揭秘
- aspose实现在线预览pptdocexcelpdf
- Aspose.Pdf 17.7最新破解版,绝对可用
- aspose-words 19.5jdk
- 使用Aspose组件文档转图片
- Trajectory Planning for Automatic Machines and
- SSH集成JasperReport,支持预览导出Exce导
- Aspose.Words.dll文件.zip
- Aspose.Words帮助API
- Aspose.Words.dll155229
- Aspose类,PDF转word
- 批量处理doc和pdf水印
- Aspose.Words.dll
- Aspose.word for .NET 18.7破解版(附Core)亲
- Aspose.Words.dll 和帮助手册
- Aspose.Slides v15.3.1破解版
- Aspose16.01及其授权
- Aspose.Words
- aspose.pdf.dll
- Aspose.total 破解办法仅限测试、研究
- Aspose.Slides for net 4.0 16.12破解
评论
共有 条评论