【问题标题】:Aspose size of document increase after inserting an image插入图像后假设文档大小增加
【发布时间】:2026-01-30 02:55:01
【问题描述】:

我们正在使用 aspose 生成 word 和 pdf 报告。报告大小约为 1.5 mb,其中没有嵌入任何图像。 我们正在使用 documentBuilder.InsertImage(byte [] byteArray) 用于传递大小为 61 kb 的字节数组。但插入图像后,文档的大小变为 15 mb。 有什么办法可以减小文档的大小 我们使用的是授权 aspose.net 版本

【问题讨论】:

    标签: asp.net .net aspose


    【解决方案1】:

    我使用 word 文件(1.75 MB)和图像文件(1 MB 高分辨率)尝试了您的方案,并使用 DocumentBuilder.InsertImage(byte [] byteArray) 方法将图像插入到 word 文件中。生成的文件大约为 3.5 MB(使用 Aspose.Words 生成)。如果我使用 MS Word 插入相同的图像,生成的文件大小为 2.75 MB。因此,Aspose.Words 和 MS Words 输出之间存在差异。但是,在你的情况下,差异是巨大的。

    原因可能是:

    1: Your code might be adding image multiple times causing file size
    to grow.
    
    2: Issue might be specific to your word file or image file.
    
    3: You might be using an old version of Aspose.Words API.
    

    我建议你:

    1: Share your code here to check if it is same as mine.
    
    2: Download and try the latest version of Aspose.Words API as Aspose
    team is constantly working on improving the performance and seeing
    your results, it seems you might be using an older version.
    
    3: Share your word document and image file on Aspose Support Forums
    and Aspose team can further investigate your issue.
    

    【讨论】: