Class PageMarginBoxes
java.lang.Object
com.itextpdf.layout.properties.margins.PageMarginBoxes
Class to store information about all page margin boxes for a single page.
-
Constructor Summary
ConstructorsConstructorDescriptionPageMarginBoxes(PageMarginBoxes other) Creates newPageMarginBoxesinstance by copying existing one.PageMarginBoxes(List<PageMarginContent> margins) Creates newPageMarginBoxesinstance. -
Method Summary
Modifier and TypeMethodDescriptionstatic IRenderercreateRendererFromElement(IElement element, DocumentRenderer documentRenderer, PdfDocument pdfDocument) Creates renderer from element excluding page breaks and adds tagging tree hints.voiddraw(DocumentRenderer documentRenderer, PdfDocument document, int pageNumber) Draws all page margins for the page specified via page number.static voiddraw(IRenderer marginRenderer, Rectangle marginRect, DocumentRenderer documentRenderer, PdfDocument document, int pageNumber, String marginBoxName) Draws all page margins for the page specified via page number.booleanfloat[]Gets page margin sizes in top, right, bottom, left order.getPageMarginContent(MarginBoxName marginBoxName) Gets page margin contentPageMarginContentby margin box name.inthashCode()float[]layout(DocumentRenderer documentRenderer, int pageNumber, Rectangle pageSize) Layouts all page margins to calculate their occupied area and page margin sizes.setMarginSizes(float[] marginSizes) Sets page margin sizes in top, right, bottom, left order.protected voidsetPageMarginTagRole(IElement element) Sets the role of the page margin element to use in the document tag tree.
-
Constructor Details
-
PageMarginBoxes
Creates newPageMarginBoxesinstance.- Parameters:
-
margins- list ofPageMarginContentinstances representing page margin content for corresponding margin box nameMarginBoxName(position on the page)
-
PageMarginBoxes
Creates newPageMarginBoxesinstance by copying existing one.- Parameters:
-
other-PageMarginBoxesto copy
-
-
Method Details
-
draw
public static void draw(IRenderer marginRenderer, Rectangle marginRect, DocumentRenderer documentRenderer, PdfDocument document, int pageNumber, String marginBoxName) Draws all page margins for the page specified via page number.- Parameters:
-
marginRenderer- renderer for the margin content to draw -
marginRect- page margin box rectangle -
documentRenderer- document renderer to use as parent for margin renderer -
document-PdfDocumentto which content is written -
pageNumber- page number -
marginBoxName- string value representing margin box name (defining its position on the page)
-
createRendererFromElement
public static IRenderer createRendererFromElement(IElement element, DocumentRenderer documentRenderer, PdfDocument pdfDocument) Creates renderer from element excluding page breaks and adds tagging tree hints.- Parameters:
-
element-IElementto create renderer for -
documentRenderer- document renderer to use as parent for margin renderer -
pdfDocument-PdfDocumentto which content is written - Returns:
-
created
IRenderer
-
getPageMarginContent
Gets page margin contentPageMarginContentby margin box name.- Parameters:
-
marginBoxName-MarginBoxNamemargin box name to get content for - Returns:
-
page margin content
PageMarginContentby margin box name
-
getMarginSizes
public float[] getMarginSizes()Gets page margin sizes in top, right, bottom, left order.- Returns:
- array of float top, right, bottom, left margin sizes
-
setMarginSizes
Sets page margin sizes in top, right, bottom, left order.- Parameters:
-
marginSizes- array of float top, right, bottom, left margin sizes - Returns:
-
this same
PageMarginBoxesinstance
-
layout
Layouts all page margins to calculate their occupied area and page margin sizes.- Parameters:
-
documentRenderer-DocumentRendererrenderer for the document to which content will be written -
pageNumber- page number -
pageSize- page size - Returns:
- float array of top, right, bottom, left margin sizes
-
draw
Draws all page margins for the page specified via page number.- Parameters:
-
documentRenderer- document renderer to use as parent for margin renderer -
document-PdfDocumentto which content is written -
pageNumber- page number
-
setPageMarginTagRole
Sets the role of the page margin element to use in the document tag tree.- Parameters:
-
element-IElementto set role for
-
equals
-
hashCode
public int hashCode()
-