/ PDF / PdfLayoutBreakType
Search results

PdfLayoutBreakType API in JavaScript PDF API control

Public enum to define a layout Break type for drawing

// Load an existing document
let document: PdfDocument = new PdfDocument(data);
// Access the first page
let page: PdfPage = document.getPage(0);
// Assign the array of string for items
let products: string[] = ['Excel', 'Power', 'Point', 'Word', 'PDF'];
// Add the item to list item collection by passing the string array
let items: PdfListItemCollection = new PdfListItemCollection(products);
// Create a new ordered list
let list: PdfOrderedList = new PdfOrderedList(items);
// Create a layout for drawing
let pageLayout: PdfLayoutFormat = new PdfLayoutFormat();
// Set  the layout break type for drawing
pageLayout.break = PdfLayoutBreakType.fitPage;
// Draw the list associated with items along with layout
list.draw(page, 0, 20, 500, 700, pageLayout);
// Save the document
document.save('output.pdf');
// Destroy the document
document.destroy();
  • fitElement - Specifies that content should break to a new page or element to fit within specified dimensions.
  • fitPage - Specifies that content should break to a new page to fit within specified dimensions.