We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Bullet List

Hello,

I wanted to create a bulletList for my PDF file but I couldn’t find a way to do it in the Documentation. Is there a way to do it? (I’m in Java)

Thanks in advance!

@Blegork

You can please use following code snippet to add bullets in PDF document:

String outFile = dataDir + "bulletlist.pdf";
// Input data:
java.util.List<String> bulletList = new java.util.ArrayList<String>();
bulletList.add("Things we do out of:");
bulletList.add("Tend to have errors related to inattention, slips, or lapses of memory");

byte[] buffer = new byte[] { (byte)149 };
String bullet = new String(buffer, "Windows-1252");

//Instantiate Pdf object by calling its empty constructor
Document doc = new Document();
// Create a section in the Pdf object
Page page = doc.getPages().add();

// Create dash text
for (int i = 0; i < bulletList.size(); i++)
{
 TextFragment bulletFragment = new TextFragment(bullet + " " + bulletList.get(i));
  bulletFragment.getTextState().setFont(FontRepository.findFont("Arial"));
  page.getParagraphs().add(bulletFragment);
}
doc.save(outFile);
1 Like

Thanks a lot for your answer! This is exactly what I needed!

1 Like