Answer the question
In order to leave comments, you need to log in
How to use an image as a list symbol?
I know what SetListSymbol
(from the library ITextSharp
) uses string
as a parameter, is it possible to use an image/icon instead? If so, how?
Answer the question
In order to leave comments, you need to log in
See the ListWithImageAsBullet
example . In the example, we take an image of a light bulb and use it as a list marker:
Image image = Image.getInstance(IMG);
image.scaleAbsolute(12, 12);
image.setScaleToFitHeight(false);
List list = new List();
list.setListSymbol(new Chunk(Image.getInstance(image), 0, 0));
list.add("Hello World");
list.add("This is a list item with a lot of text. It will certainly take more than one line. This shows that the list item is indented and that the image is used as bullet.");
list.add("This is a test");
document.add(list);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question