Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
Aspose.WordsforJava允许用户将多页文档导出为光栅图像。 这对于生成预览、存档或文档的可视化表示以供不可编辑使用非常有用。
Aspose.Words支持将多页导出为以下栅格图像格式:
将多页文档导出到图像的功能是使用MultiPageLayout类实现的–您可以指定保存到图像时应如何组织页面:
下面的代码示例演示如何将多页DOCX文档保存为具有水平布局的JPEG图像:
Document doc = new Document("Rendering.docx");
ImageSaveOptions options = new ImageSaveOptions(SaveFormat.JPEG);
// Set up Horizontal layout.
options.setPageLayout = MultiPageLayout.Horizontal(10);
doc.save("ImageSaveOptions.HorizontalLayout.jpg", options);
您还可以自定义输出文件页面外观-指定BackColor、BorderColor和BorderWidth。
下面的代码示例演示如何使用网格布局将多页DOCX文档保存为PNG图像:
Document doc = new Document("Rendering.docx");
ImageSaveOptions options = new ImageSaveOptions(SaveFormat.PNG);
// Set up a grid layout with:
// - 3 columns per row.
// - 10pts spacing between pages (horizontal and vertical).
options.setPageLayout(MultiPageLayout.grid(3, 10f, 10f));
// Customize the background and border.
options.getPageLayout().setBackColor(Color.lightGray);
options.getPageLayout().setBorderColor(Color.BLUE);
options.getPageLayout().setBorderWidth(2f);
doc.save("ImageSaveOptions.GridLayout.png", options);
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.