8.第八单元(邓燕).docx (39.9 KB)
我在用aspose.words将附件的文档转换为pdf的时候,转出来的pdf看起来右边框线好像是被图像切割了一样,和word转出来的不一样,特别是在缩小缩放比例的时候特别明显,你们可以试试用aspose和word转出来的效果是不是一模一样的
转换pdf部分的代码:
string DocumentName, SaveDocxName;
//设置加载word文档的时候参数
Aspose.Words.Loading.LoadOptions TempDocuemntLoadOption = new Aspose.Words.Loading.LoadOptions()
{
ConvertMetafilesToPng = true,
MswVersion = Aspose.Words.Settings.MsWordVersion.Word2010,
};
//设置PDF保存参数
Aspose.Words.Saving.PdfSaveOptions TempPdfaveOption = new Aspose.Words.Saving.PdfSaveOptions()
{
FontEmbeddingMode = Aspose.Words.Saving.PdfFontEmbeddingMode.EmbedAll,
ColorMode = Aspose.Words.Saving.ColorMode.Normal,
ImageColorSpaceExportMode = Aspose.Words.Saving.PdfImageColorSpaceExportMode.Auto,
//ImageCompression = Aspose.Words.Saving.PdfImageCompression.Auto,
PageMode = Aspose.Words.Saving.PdfPageMode.UseOutlines,
ZoomBehavior = Aspose.Words.Saving.PdfZoomBehavior.None,
SaveFormat = Aspose.Words.SaveFormat.Pdf,
UseHighQualityRendering = true,
UseAntiAliasing = true,
PreblendImages = true,
JpegQuality = 100,
Compliance = Aspose.Words.Saving.PdfCompliance.Pdf17,
};
//设置PDF保存带word中的目录
TempPdfaveOption.OutlineOptions.DefaultBookmarksOutlineLevel = 0;
TempPdfaveOption.OutlineOptions.CreateMissingOutlineLevels = false;
TempPdfaveOption.OutlineOptions.ExpandedOutlineLevels = 3;
TempPdfaveOption.OutlineOptions.HeadingsOutlineLevels = 9;
TempPdfaveOption.HeaderFooterBookmarksExportMode = Aspose.Words.Saving.HeaderFooterBookmarksExportMode.All;
//设置Docx保存参数
Aspose.Words.Saving.OoxmlSaveOptions TempDocxSaveOption = new Aspose.Words.Saving.OoxmlSaveOptions()
{
//Compliance = Aspose.Words.Saving.OoxmlCompliance.Iso29500_2008_Strict,
SaveFormat = Aspose.Words.SaveFormat.Docx,
};
Aspose.Words.Document TempDocument = new Aspose.Words.Document(documentFileName, TempDocuemntLoadOption);
//TempDocument.JustificationMode = Aspose.Words.Settings.JustificationMode.CompressKana;
DocumentName = System.IO.Path.GetFileNameWithoutExtension(documentFileName);
SaveDocxName = System.IO.Path.Combine(tempSaveDocxPath, DocumentName + ".docx");
TempDocument.UpdateFields();
TempDocument.Save(SaveDocxName, TempDocxSaveOption);
Aspose.Words.Document TempDocxDocument = new Aspose.Words.Document(SaveDocxName, TempDocuemntLoadOption);
//TempDocxDocument.JustificationMode = Aspose.Words.Settings.JustificationMode.CompressKana;
TempDocxDocument.UpdateFields();
TempDocxDocument.Save(SavePdfName, TempPdfaveOption);
是不是代码中有什么参数错了,还是有什么参数没设置对?091644lp5uzk7dccu55ssk.png (29.6 KB)