Total de paginas no rtf usando iText-rtf

1 resposta
Kassiane_Pretti

Olá pessoal

estou precisando colocar o total de páginas em um arquivo rtf, mas não está dando muito certo =/

Código:

Document document = new Document();
            RtfWriter2.getInstance(document, new FileOutputStream("TotalPageNumber.rtf"));

            // Create a new Paragraph for the footer
            Paragraph par = new Paragraph("Page ");

            // Add the RtfPageNumber to the Paragraph
            par.add(new RtfPageNumber());
            
            // Add the RtfTotalPageNumber to the Paragraph
            par.add(" of ");
            par.add(new RtfTotalPageNumber());
            
            // Create an RtfHeaderFooter with the Paragraph and set it
            // as a header for the document
            RtfHeaderFooter header = new RtfHeaderFooter(par);
            document.setHeader(header);
            
            document.open();

            for(int i = 1; i <= 300; i++) {
                document.add(new Paragraph("Line " + i + "."));
            }

            document.close();

e estou usando as libs: iText-1.3.1 e iText-rtf-2.1.4

Será que alguém pode me ajudar?

Att :wink:

1 Resposta

Kassiane_Pretti

Esqueci de colocar a mensagem que dá quando executo o programa:

"Não é possível mostrar erro como exceção enquanto não estiver ajustada.

Após fechar esta janela, pressione o botão Atualizar ou Recarregar do seu navegador para continuar."

Criado 5 de maio de 2009
Ultima resposta 5 de mai. de 2009
Respostas 1
Participantes 1