PdfLayoutFormat

12 Sep 20251 minute to read

Represent the layout format class for pagination

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data);
// Access the first page
let page: PdfPage = document.getPage(0);
// Create an instance of list item collection by passing the string array
let items: PdfListItemCollection = new PdfListItemCollection(['Excel', 'Power', 'Point', 'Word', 'PDF']);
// Create a new PDF ordered list
let list: PdfOrderedList = new PdfOrderedList(items);
// Create an instance for PDF layout format
let layout: PdfLayoutFormat = new PdfLayoutFormat();
// Set the layout format
layout.break = PdfLayoutBreakType.fitPage;
layout.layout = pdfLayoutType.paginate;
// Draw the items using specified bounds and layout format
list.draw(page, 0, 20, layout);
// Save the document
document.save('output.pdf');
// Destroy the document
document.destroy();

Properties

break PdfLayoutBreakType

Gets the layout break type of the page.

layout PdfLayoutType

Gets the layout type of the page.

paginateBounds number[]

Gets the paginate bounds of the page.

usePaginateBounds boolean

Gets whether to use paginate bounds for pagination.