/ PDF / PdfListItemCollection
Search results

PdfListItemCollection API in JavaScript PDF API control

Represents a collection of list items that can be drawn on a PDF page.

// 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']);
// Create a new PDF ordered list
let list: PdfOrderedList = new PdfOrderedList(items);
// Draw the list items
list.draw(page, 0, 20);
// Save the document
document.save('output.pdf');
// Destroy the document
document.destroy();

Properties

count number

Gets the count of the list item collection.

Methods

add

Adds a PdfListItem to the collection.

Parameter Type Description
item PdfListItem The list item to be added to the collection.
typescript<br>// Load an existing PDF document<br>let document: PdfDocument = new PdfDocument(data, password);<br>// Access the first page of the document<br>let page: PdfPage = document.getPage(0);<br>// Create an instance of ordered list<br>let list: PdfOrderedList = new PdfOrderedList();<br>// Add the items to list item collection by passing the array of products<br>let item: PdfListItem = new PdfListItem('Hello World');<br>// Add the item to the list<br>list.items.add(item);<br>// Draw the list on the page at specified coordinates and dimensions<br>list.draw(page, 20, 50, 500, 700);<br>// Save the document<br>document.save('output.pdf');<br>// Destroy the document<br>document.destroy();<br>

Returns void

add

Adds a PdfListItem to the collection.

Parameter Type Description
item PdfListItem The list item to be added to the collection.
itemIndent number The indent of the list item
typescript<br>// Load an existing PDF document<br>let document: PdfDocument = new PdfDocument(data, password);<br>// Access the first page of the document<br>let page: PdfPage = document.getPage(0);<br>// Create an instance of PdfOrderedList<br>let list: PdfOrderedList = new PdfOrderedList();<br>// Create a new item by passing a string value<br>let item: PdfListItem = new PdfListItem('Hello World');<br>// Add the item to the list with a specified text indent<br>list.items.add(item, 40);<br>// Draw the list on the page at specified coordinates and dimensions<br>list.draw(page, 20, 50, 500, 700);<br>// Save the document<br>document.save('output.pdf');<br>// Destroy the document<br>document.destroy();<br>

Returns void

at

Retrieves the PdfListItem at the specified index in the collection.

Parameter Type Description
index number The zero-based index of the item to retrieve.

Returns PdfListItem

clear

Clear the list item collection.

Returns void

indexOf

Finds the index of a PdfListItem in the collection.

Parameter Type Description
item PdfListItem The list item to find in the collection.

Returns number

insert

Inserts a PdfListItem into the collection at the specified index.

Parameter Type Description
index number The zero-based index at which the item should be inserted.
item PdfListItem The list item to be inserted into the collection.
itemIndent number The indent of the list item.

Returns void

remove

Removes a PdfListItem from the collection.

Parameter Type Description
item PdfListItem The list item to be removed from the collection.

Returns void

removeAt

Removes a PdfListItem at the specified index from the collection.

Parameter Type Description
index number The zero-based index of the item to remove.

Returns void