-
Notifications
You must be signed in to change notification settings - Fork 213
Open
Description
https://products.aspose.com/words/zh/java/compress/
doc.cleanup();
NodeCollection nodes = doc.getChildNodes(NodeType.SHAPE, true);
for (Shape shape : (Iterable) nodes)
{
if (shape.isImage())
{
// 由开发人员选择用于图像压缩的库。
BufferedImage image = ImageIO.read(shape.getImageData().toStream());
// 压缩图像并将其设置回形状。
shape.getImageData().setImage("yourCompressedImage");
}
}
OoxmlSaveOptions saveOptions = new OoxmlSaveOptions();
saveOptions.setCompressionLevel(CompressionLevel.MAXIMUM);
doc.save("Output.docx", saveOptions);
In this example, using this code to report an error
Required type: Object
Provided: Shape
my maven
<groupId>com.aspose</groupId>
<artifactId>aspose-words</artifactId>
<version>22.11</version>
<classifier>jdk17</classifier>
</dependency>
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-words</artifactId>
<version>22.11</version>
<classifier>javadoc</classifier>
</dependency>
Metadata
Metadata
Assignees
Labels
No labels