首页 新闻 会员 周边

Aspose.Words 转换图片的问题

0
[已关闭问题] 关闭于 2013-10-11 16:05
 1                     string filePath = string.Empty;
 2                     Document doc = new Document();
 3                     int ran = new Random().Next(100);
 4                     fileName = DateTime.Now.ToString("yyyyMMddHHmmss") + ran + strExt.Trim('*');
 5                     filePath = Path.Combine(path, fileName);
 6 
 7                     fileUpload.SaveAs(filePath);
 8                     doc = new Document(filePath);
 9                     foreach (Section section in doc)
10                     {
11                         section.PageSetup.PaperSize = PaperSize.A4;
12                         section.PageSetup.Orientation = Aspose.Words.Orientation.Portrait;
13                         section.PageSetup.VerticalAlignment = Aspose.Words.PageVerticalAlignment.Top; 
14                     }
15 
16                     string imageName = fileName.Replace(strExt.Trim('*'), "");
17                     this.Session["ChangeImage"] = new CLS_ChangeImage { Index = 0, SumCount = doc.PageCount, NumState = 0 };
18 
19                     ImageSaveOptions iso = new ImageSaveOptions(SaveFormat.Jpeg);
20                     iso.PrettyFormat = true;
21                     iso.UseAntiAliasing = true;
22                     ci.NumState = 2;
23                     this.Session["ChangeImage"] = ci;
24                     System.Text.StringBuilder sbImg = new StringBuilder();
25                     string imgSavePath = ConfigurationManager.AppSettings["UploadPath"];
26                     for (int i = 0; i < doc.PageCount; i++)
27                     {
28                         ci.Index = i + 1;
29                         ci.SumCount = doc.PageCount;
30 
31                         iso.PageIndex = i;
32                         string iName = imageName + "_" + i + ".jpg";
33 
34                         doc.Save(path + "/" + iName, iso);
35                         FileStream file = new FileStream(path + "/" + iName, FileMode.Open);
36 
37                         AF.UploadFileBinary(file, iName);//吧文件保存到另外一个地方
38                         sbImg.Append(iName + "|");
39                         this.Session["ChangeImage"] = ci;
40                         //System.Threading.Thread.Sleep(5000);
41 
42                     }

以上代码转换出来的图片与原文档格式上有所偏差,有什么解决方案吗?

 

以下是转换前的文档( 第7章到了第二节就换页了

而转换后的的图片却不一样

小明冥的主页 小明冥 | 菜鸟二级 | 园豆:222
提问于:2013-07-17 09:56
< >
分享
所有回答(2)
0

Aspose 不是有 support forum吗, 去那里问问吧

gunsmoke | 园豆:3592 (老鸟四级) | 2013-07-18 11:15

给个地址吧

支持(0) 反对(0) 小明冥 | 园豆:222 (菜鸟二级) | 2013-07-24 08:54
0

aspose厂商:官方活动页

喂,胖娃吗 | 园豆:204 (菜鸟二级) | 2013-11-05 13:31
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册