LayoutEngine
Overview
LayoutEngine is a class in Aspose.PDF FOSS for Java.
The main layout engine that converts high-level paragraph objects into PDF content stream bytes during {@code Document.save()}.
This class provides 11 methods for working with LayoutEngine objects in Java programs.
Available methods include: LayoutEngine, buildHeaderFooterOverlay, layout, layoutHeading, layoutParagraph, layoutStamps, layoutTable, layoutTextFragment, layoutTextStamp, resetNoteState, setPageNumbering.
All public members are accessible to any Java application after installing the Aspose.PDF FOSS for Java package.
Methods
| Signature | Description |
|---|---|
LayoutEngine() | Creates a new LayoutEngine. |
setPageNumbering(pageNumber: int, totalPages: int) | Sets the page numbering context for $p / $P variable substitution. |
layout(page: Page) | Performs layout on a page, converting its paragraphs into a PDF content stream. |
buildHeaderFooterOverlay(page: Page) → HeaderFooterOverlay | Lays out only this page’s header and footer paragraphs (set via |
| {@link Page#setHeader}/{@link Page#setFooter}) into a standalone content | |
| stream, WITHOUT touching the page’s existing {@code /Contents} or | |
| {@code /Resources}. | |
layoutParagraph(para: BaseParagraph, builder: ContentStreamBuilder, resources: ResourceBuilder, ctx: LayoutContext) → double | Dispatches a paragraph to the appropriate type-specific renderer. |
layoutTextFragment(tf: TextFragment, builder: ContentStreamBuilder, resources: ResourceBuilder, ctx: LayoutContext) → double | Lays out a TextFragment with word wrapping, font selection, and color. |
resetNoteState() | |
layoutHeading(heading: Heading, builder: ContentStreamBuilder, resources: ResourceBuilder, ctx: LayoutContext) → double | Lays out a Heading paragraph, rendering it as a TOC entry with optional |
| dot leader line and page number. | |
layoutTable(table: Table, builder: ContentStreamBuilder, resources: ResourceBuilder, ctx: LayoutContext) → double | Lays out a Table with borders, backgrounds, and cell content. |
layoutStamps(page: Page, builder: ContentStreamBuilder, resources: ResourceBuilder) | Applies stamp overlays (TextStamp, ImageStamp, PageNumberStamp) to the page. |
layoutTextStamp(stamp: TextStamp, builder: ContentStreamBuilder, resources: ResourceBuilder, pageWidth: double) | Lays out a TextStamp at its specified position. |