ColumnText is your friend.

Paulo

----- Original Message ----- 
From: "Aloizio Pereira da Silva" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, June 20, 2006 10:09 PM
Subject: [iText-questions] Inserting new Paragraph into existing pdf 
document


I have been studying iText Tutorial, because I need to add a new paragraph
into a existing pdf document. Paulo had suggested me to use PdfStamper. I
am using it and also a chunk that I put into a Paragraph object. Bu now
after a lot of queries in the tutorial I am not able to insert the
Paragraph
into the existing document. Below I put the code I am using.

public class TesteIText
{
  public TesteIText()
  {
  }

  public static void main(String[] args) {

    System.out.println("Iniciando teste...");

   // Document document = new Document();
    try {
       //abre documento para copia
      PdfReader doc = new
PdfReader("M:\\Aloizio_SS\\SINF2.0\\docTeste.pdf");
      //cria uma copia do documento
      PdfStamper stamp = new PdfStamper(doc,
        new FileOutputStream("M:\\Aloizio_SS\\SINF2.0\\docTeste2.pdf"));
      BaseFont bf = BaseFont.createFont(BaseFont.HELVETICA,
BaseFont.WINANSI, BaseFont.EMBEDDED);
      PdfContentByte under = stamp.getUnderContent(1);
      PdfContentByte over = stamp.getOverContent(1);

      //the content to be inserted
      Font font;
      Chunk chunk;
      Paragraph p;
      p = new Paragraph("Nos termos do ");
      font = FontFactory.getFont(FontFactory.HELVETICA, Font.DEFAULTSIZE,
Font.BOLDITALIC);
      chunk = new Chunk(" Plano Geral de informatizao, ", font);
      p.add(chunk);
      font = FontFactory.getFont(FontFactory.HELVETICA, Font.DEFAULTSIZE,
Font.UNDERLINE);
      chunk = new Chunk(" solicito a Vossa Senhoria verificar a
possibilidade de que sejam instalados trs microcomputadores neste
Departamento.", font);
      p.add(chunk);

      stamp.close();

    } catch (DocumentException de) {
      System.err.println(de.getMessage());
    } catch (IOException ioe) {
      System.err.println(ioe.getMessage());
    }
    document.close();
  }
}

            *****************************************************
            *         Federal University of Minas Gerais        *
            *          Department of Computer Science           *
            *         Master Degree in Computer Science         *
            *                                                   *
            *            Fundação Getulio Vargas                *
            *            MBA in Project Management              *
            *                                                   *
            *                 Aloizio Silva                     *
            *         http://www.dcc.ufmg.br/~aloizio           *
            *                                                   *
            *      Mobile Computer and Network Optimization     *
            *****************************************************





--------------------------------------------------------------------------------


>


--------------------------------------------------------------------------------


> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> 



_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to