Hi,
I am new here. I hope this is the rigth way of sending a question about
iText...

I just started using the iText API and i think it's really good and useful.
I wrote a litte app that reads from a PDF-file, adds a comment and writes
everything into a new PDF-file.
I am using "writer.getDirectContentUnder", but the rectangles i draw appear
over the text. what's wrong in my app??

here most of my programm:
/*

 * --> Copyright 2002 by Bruno Lowagie <--
 * with help of 'iText Tutorial' at http://www.lowagie.com/iText/tutorial/
 * [EMAIL PROTECTED]
 */

import java.io.*;
import com.lowagie.text.*;
import com.lowagie.text.pdf.*;

public class AddContentToPDF {

    public static void main(String[] args) {

        try {
            PdfReader reader = new PdfReader("oldFileReader.pdf");
            int n = reader.getNumberOfPages();
            Rectangle psize = reader.getPageSize(1);

            Document document = new Document(psize); //das neue Dokument
soll dieselbe Gr��e haben

            PdfWriter writer = PdfWriter.getInstance(document, new
FileOutputStream("newFileAddContent.pdf"));

            document.open();

            PdfContentByte cb = writer.getDirectContentUnder();//should
write UNDER the Text
            int i = 0;

            while (i < n) {
                document.newPage();
                i++;
                PdfImportedPage curPage = writer.getImportedPage(reader, i);

                cb.addTemplate(curPage, 0 , 0);

                cb.setRGBColorStroke(0,255,0);
                    cb.setRGBColorFill(255,0,0);  //this does't seem to work either
                cb.rectangle(200,500,90,30);  //appears ON TOP OF the text
                cb.stroke();

                document.add(new Annotation(200f, 500f, 290f, 530f,
"http://www.SPORT1.de";));

            }

            document.close();
        }
        catch (Exception de) {
            de.printStackTrace();
        }
    }
}



-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to