Manish Kumar
Manish Kumar

Reputation: 11

Itext:Why are my bullet points appearing as dashes instead of the default bullets in pdf?

I’m facing a problem where, whenever there is an unordered list in the HTML content that I’m parsing as elements and filling into the PDF cell, everything else displays fine except the bullet points, which appear as dashes (-). What could cause this?

 ByteArrayOutputStream baos = new ByteArrayOutputStream();
 Document document = new Document(PageSize.A4, 40, 40, 40, 40);
 PdfWriter writer = PdfWriter.getInstance(document, baos);
 document.open();
 document.add(buildContent());
 document.close();

// method that should provide content to the document.

public PdfPTable buildContent() throws IOException {
InfoList infoList = infoListInstance.get();
PdfPTable table = new PdfPTable(2);
for (InfoListMessage message
: infolistList.getMessages()) {
renderMessageMetadata(message, table);
renderMessageContent(message, table);
}
return table;
}


public void renderMessageContent(
InfoListMessage message,
PdfPTable table) throws IOException {

PdfPCell cell = new PdfPCell();

for (Element e : XMLWorkerHelper.parseToElementList(message.getContent(), null)) {
cell.addElement(e);
}  
table.addCell(cell);
}

<ul> 
   <li>document2.txt.txt (23 B)</li> 
   <li>document1.txt.txt (12 B)</li>  
  </ul>
 

// method where the problem occurs and exception is thrown in the for-loop line

how to solve above issue table and cell approach only how to get unorder list in place of dashes i want bullet points

Upvotes: 1

Views: 40

Answers (0)

Related Questions