PageSetup
PageSetup:
{}Controls physical page properties for a section.
Remarks
Section titled “Remarks”PageSetup provides methods to configure and query the physical page dimensions and
margins for a section. Each section can have its own page setup, allowing different
parts of a document to use different page sizes or orientations.
Page setup is accessed via Section.pageSetup and includes:
- Page size (width and height)
- Page margins (see
PageMargins)
Example
Section titled “Example”Change to landscape orientation:
const pageSetup = section.pageSetup();const currentSize = pageSetup.pageSize();
// Swap width and height for landscapepageSetup.setPageSize({ width: currentSize.height, height: currentSize.width});Methods
Section titled “Methods”setPageSize()
Section titled “setPageSize()”setPageSize(
size):void
Sets the page size for this section.
Parameters
Section titled “Parameters”Partial<PageSize>
Partial page size with width and/or height to set
Returns
Section titled “Returns”Remarks
Section titled “Remarks”All dimensions are in points (1 point = 1/72 inch).
To change orientation, swap the width and height values.
setPageMargins()
Section titled “setPageMargins()”setPageMargins(
margins):void
Sets the page margins for this section.
Parameters
Section titled “Parameters”margins
Section titled “margins”Partial<PageMargins>
Partial PageMargins; any omitted field keeps its current value.
Returns
Section titled “Returns”Remarks
Section titled “Remarks”All dimensions are in points (1 point = 1/72 inch).
pageSize()
Section titled “pageSize()”pageSize():
PageSize
Gets the current page size for this section.
Returns
Section titled “Returns”The current PageSize with width and height
Remarks
Section titled “Remarks”All dimensions are in points (1 point = 1/72 inch).
pageMargins()
Section titled “pageMargins()”pageMargins():
PageMargins
Gets the current page margins for this section.
Returns
Section titled “Returns”The current PageMargins.
Remarks
Section titled “Remarks”All dimensions are in points (1 point = 1/72 inch).