Am trying to find an equivalent method in Itext 7 to set the below style on lists. Is there any API available in Itext7 ?
list-style-position: inside;
Yes, there is API available to set analogue of list-style-position
CSS property directly in layout
code. For that, use listElement.setProperty(Property.LIST_SYMBOL_POSITION, ListSymbolPosition.INSIDE);
Example code:
Document document = new Document(pdfDocument);
List defaultList = new List();
for (int i = 0; i < 3; i++) {
defaultList
.add("Am trying to find an equivalent method in Itext 7 to set the below style on lists. Is there any API available in Itext7");
}
List bulletPositionInsideList = new List();
for (int i = 0; i < 3; i++) {
bulletPositionInsideList
.add("Am trying to find an equivalent method in Itext 7 to set the below style on lists. Is there any API available in Itext7");
}
bulletPositionInsideList.setProperty(Property.LIST_SYMBOL_POSITION, ListSymbolPosition.INSIDE);
document.add(defaultList);
document.add(bulletPositionInsideList);
Visual result of default list vs one with list symbol position set to inside: