A little confusing heading, but the problem is somewhat simple.
I'm generating a PDF via iText and I'm using HTML because it's simpler.
I'm doing the example below the only problem is that I would like to modify the symbol of the tag <li>
to a square as below:
<li type='square'>Teste</li>
My code:
public static final String DEST = "\pdfteste\html_2.pdf";
public static void main(String[] args) {
try{
File file = new File(DEST);
file.getParentFile().mkdirs();
new TestiText7().createPdf(DEST);
}catch(Exception ex){
ex.printStackTrace();
}
}
public void createPdf(String file) throws IOException, DocumentException {
// step 1
Document document = new Document();
// step 2
PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(file));
writer.setInitialLeading(12);
// step 3
document.open();
// step 4
StringBuilder sb = new StringBuilder();
sb.append("<html><head></head><body>");
sb.append("<ol><li>Teste</li>");
sb.append("<li>Teste</li>");
sb.append("<ul><li>Teste</li><li>Teste</li></ul>");
sb.append("<li>Teste</li>");
sb.append("<ul><li>Teste</li><li>Teste</li><ul><li type=\"square\">Teste</li></ul></ul>");
sb.append("</ol>");
sb.append("</body><html>");
XMLWorkerHelper.getInstance().parseXHtml(writer, document,
new StringReader(sb.toString()));
// step 5
document.close();
}
}
This is the result in the file. Has anyone experienced something or just can not do it?