PdfLayoutResult

16 Dec 20251 minute to read

Represents a class for layout result in PDF generation.

// Load an existing document
let document: PdfDocument = new PdfDocument(data);
// Access the first page
let page: PdfPage = document.getPage(0);
// Add the items to list item collection by passing the array of products
let items: PdfListItemCollection = new PdfListItemCollection(['Excel', 'Power', 'Point', 'Word', 'PDF']);
// Create a new ordered list
let list: PdfOrderedList = new PdfOrderedList(items);
// Draw the list and access the layout result
let result: PdfLayoutResult = list.draw(page, {x: 20, y: 20, width: 500, height: 300});
// Create a new unordered list
let list: PdfUnorderedList = new PdfUnorderedList(items);
// Draw the list and access the layout result
result = list.draw(result.page, {x: result.bounds.x, y: result.bounds.y + result.bounds.height + 10, width: 500, height: 300});
// Save the document
document.save('output.pdf');
// Destroy the document
document.destroy();

Properties

Page PdfPage

Gets the page associated with the layout result.

bounds Rectangle

Gets the bounds associated with the layout result.