public class Size extends Object
The Size class represents the size of a watermark in the GroupDocs.Viewer component. It provides options to specify the dimensions of the watermark, such as width and height.
Example usage:
Watermark watermark = new Watermark("Watermark");
watermark.setPosition(Position.DIAGONAL);
watermark.setColor(java.awt.Color.GREEN);
watermark.setSize(Size.HALF_SIZE);
PdfViewOptions pdfViewOptions = new PdfViewOptions();
pdfViewOptions.setWatermark(watermark);
try (Viewer viewer = new Viewer("document.docx")) {
viewer.view(pdfViewOptions);
// Use the viewer object for further operations
}
Viewer,
Watermark,
PdfViewOptions| Modifier and Type | Field and Description |
|---|---|
static Size |
FULL_SIZE
Represents the maximum size of watermark text that fits the page.
|
static Size |
HALF_SIZE
Represents half of the maximum size of watermark text that fits the page.
|
static Size |
ONE_THIRD
Represents one third of the maximum size of watermark text that fits the page.
|
| Constructor and Description |
|---|
Size(byte relativeSize)
Initializes a new instance of the
Size class. |
| Modifier and Type | Method and Description |
|---|---|
byte |
getRelativeSize()
Returns the watermark text size in percentages in relation to the page width.
|
public static final Size FULL_SIZE
Represents the maximum size of watermark text that fits the page.
public static final Size HALF_SIZE
Represents half of the maximum size of watermark text that fits the page.
public static final Size ONE_THIRD
Represents one third of the maximum size of watermark text that fits the page.
public Size(byte relativeSize)
throws IllegalArgumentException
Initializes a new instance of the Size class.
relativeSize - The size in percentages in relation to the page size.IllegalArgumentException - Thrown when the relativeSize is zero or higher than 100.Copyright © 2024. All rights reserved.