How to add PDF reference mark with Itext 5.14

Asked

Viewed 177 times

0

I need my footer to contain a description for a reference mark, for those who do not know it is those numbers that get high in a word, and are referenced in the footer with an explanation of that content. I already have the method to create the footer, but I can’t find how to put the reference number.

 Font fonteTimes = FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, 
 Font.NORMAL);
 PdfPTable table = new PdfPTable(1);
 table.getDefaultCell().setBorder(Rectangle.TOP);
 table.addCell("*marca1* e explicação");

 table.writeSelectedRows(0, -1, document.left(document.leftMargin()), 
 table.getTotalHeight() + document.bottom(document.bottomMargin()), 
 writer.getDirectContent());

I have created a list with sublists. Where these have items that are basically Paragraph. These items contain information about laws, which should be explained in the footnote. I am creating the lists as follows:

List listaRomana = new RomanList();
listaRomana.add(new ListItem(new Paragraph("item1:", fonteNegrito)));

ArrayList<String> relatorio = new ArrayList<>();
relatorio.add("Fundamento na Lei Federal n° 19.003/1998*marca1*");
List subLista1 = criaSubLista(relatorio, fonte, true, false);

private List criaSubLista(ArrayList<String> itens, Font fonte, boolean 
   ehNumber, boolean ehLetra) {

 List subLista = new List(ehNumber, ehLetra);
 for (String descricao : itens) {
    Paragraph para = new Paragraph(descricao, fonte);
    subLista.add(new ListItem(para));
 }
 return subLista;
 }

This is basically what I have, after creating the list and sub-list, I add them to Document. As you can see, within the sublist I pass a sentence with a law, this should have a reference mark, and I want to be able to refer it to the footnote

  • Send more code, so we can better help you

  • I added new information, I need some means to make the document work

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.