MultiPageLayout
Inheritance: java.lang.Object
public class MultiPageLayout
Defines a layout for rendering multiple pages into a single output.
Remarks:
Use one of the static factory methods to create a layout configuration.
Examples:
Shows how to save the document into JPG image with multi-page layout settings.
Document doc = new Document(getMyDir() + "Rendering.docx");
ImageSaveOptions options = new ImageSaveOptions(SaveFormat.JPEG);
// Set up a grid layout with:
// - 3 columns per row.
// - 10pts spacing between pages (horizontal and vertical).
options.setPageLayout(MultiPageLayout.grid(3, 10f, 10f));
// Alternative layouts:
// options.PageLayout = MultiPageLayout.Horizontal(10);
// options.PageLayout = MultiPageLayout.Vertical(10);
// Customize the background and border.
options.getPageLayout().setBackColor(Color.lightGray);
options.getPageLayout().setBorderColor(Color.BLUE);
options.getPageLayout().setBorderWidth(2f);
doc.save(getArtifactsDir() + "ImageSaveOptions.GridLayout.jpg", options);
Methods
Method | Description |
---|---|
getBackColor() | Gets the background color of the output. |
getBorderColor() | Gets the color of the pages border. |
getBorderWidth() | Gets the width of the pages border. |
grid(int columns, float horizontalGap, float verticalGap) | Creates a layout in which pages are rendered left-to-right, top-to-bottom, in a grid with the specified number of columns. |
horizontal(float horizontalGap) | Creates a layout in which all specified pages are rendered horizontally side by side, left to right, in a single output. |
setBackColor(Color value) | Sets the background color of the output. |
setBorderColor(Color value) | Sets the color of the pages border. |
setBorderWidth(float value) | Sets the width of the pages border. |
singlePage() | Creates a layout that renders only the first of specified pages. |
tiffFrames() | Creates a layout where each page is rendered as a separate frame in a multi-frame TIFF image. |
vertical(float verticalGap) | Creates a layout where all specified pages are rendered vertically one below the other in a single output. |
getBackColor()
public Color getBackColor()
Gets the background color of the output. The default is java.awt.Color#EMPTY.EMPTY.
Returns: java.awt.Color - The background color of the output.
getBorderColor()
public Color getBorderColor()
Gets the color of the pages border. The default is java.awt.Color#EMPTY.EMPTY.
Returns: java.awt.Color - The color of the pages border.
getBorderWidth()
public float getBorderWidth()
Gets the width of the pages border. The default is 0.
Returns: float - The width of the pages border.
grid(int columns, float horizontalGap, float verticalGap)
public static MultiPageLayout grid(int columns, float horizontalGap, float verticalGap)
Creates a layout in which pages are rendered left-to-right, top-to-bottom, in a grid with the specified number of columns.
Parameters:
Parameter | Type | Description |
---|---|---|
columns | int | The number of columns in the layout. Must be greater than zero. |
horizontalGap | float | The horizontal gap between columns in points. |
verticalGap | float | The vertical gap between rows in points. |
Returns: MultiPageLayout
horizontal(float horizontalGap)
public static MultiPageLayout horizontal(float horizontalGap)
Creates a layout in which all specified pages are rendered horizontally side by side, left to right, in a single output.
Parameters:
Parameter | Type | Description |
---|---|---|
horizontalGap | float | The horizontal gap between pages in points. |
Returns: MultiPageLayout
setBackColor(Color value)
public void setBackColor(Color value)
Sets the background color of the output. The default is java.awt.Color#EMPTY.EMPTY.
Parameters:
Parameter | Type | Description |
---|---|---|
value | java.awt.Color | The background color of the output. |
setBorderColor(Color value)
public void setBorderColor(Color value)
Sets the color of the pages border. The default is java.awt.Color#EMPTY.EMPTY.
Parameters:
Parameter | Type | Description |
---|---|---|
value | java.awt.Color | The color of the pages border. |
setBorderWidth(float value)
public void setBorderWidth(float value)
Sets the width of the pages border. The default is 0.
Parameters:
Parameter | Type | Description |
---|---|---|
value | float | The width of the pages border. |
singlePage()
public static MultiPageLayout singlePage()
Creates a layout that renders only the first of specified pages.
Returns: MultiPageLayout
tiffFrames()
public static MultiPageLayout tiffFrames()
Creates a layout where each page is rendered as a separate frame in a multi-frame TIFF image. Applicable only to TIFF image formats.
Returns: MultiPageLayout
vertical(float verticalGap)
public static MultiPageLayout vertical(float verticalGap)
Creates a layout where all specified pages are rendered vertically one below the other in a single output.
Parameters:
Parameter | Type | Description |
---|---|---|
verticalGap | float | The vertical gap between pages in points. |
Returns: MultiPageLayout