>So you're not talking about an annotation,
>but about real content?
>
>In that case it's also simple to achieve what you need.
>If you know the coordinates, you can create a Rectangle object
>and add that to the document.
>
>If you don't know the coordinates, you can retrieve them in
>a cell event, and use the method PdfContentByte.rectangle().
>Don't forget to call the fill() method, otherwise you'll only
>add the path of the rectangle without filling it.
I already tried to, but the PdfPTable is always printed ontop of the rectangle
I tried as followed:
1.: create an instance of Document
2.: creating an instance of PDFWriter
3.: creating an instance of PdfPTable
4.: add cells to table instance
5.: call drawRectangles() // instead of 7.
6.: add table instance to document
7.: call drawRectangles() // instead of 5.
8.: close document
void drawRectangles() {
PdfContentByte canvas = writer.getDirectContent();
canvas.saveState(); // tried with and without saving state
canvas.setColorFill(BaseColor.RED);
canvas.rectangle(1, 100, 100, 100);
canvas.fill();
canvas.restoreState(); // tried with and without restoring state
}
When drawing the rectangle before adding the table instance to the document,
the rectangle gets overlapped by the table content.
When drawing the rectangle after the table is added to the document,
the rectangle is drawn at a seperate page of the document.
Sorry for being a pest ...
>but about real content?
>
>In that case it's also simple to achieve what you need.
>If you know the coordinates, you can create a Rectangle object
>and add that to the document.
>
>If you don't know the coordinates, you can retrieve them in
>a cell event, and use the method PdfContentByte.rectangle().
>Don't forget to call the fill() method, otherwise you'll only
>add the path of the rectangle without filling it.
I already tried to, but the PdfPTable is always printed ontop of the rectangle
I tried as followed:
1.: create an instance of Document
2.: creating an instance of PDFWriter
3.: creating an instance of PdfPTable
4.: add cells to table instance
5.: call drawRectangles() // instead of 7.
6.: add table instance to document
7.: call drawRectangles() // instead of 5.
8.: close document
void drawRectangles() {
PdfContentByte canvas = writer.getDirectContent();
canvas.saveState(); // tried with and without saving state
canvas.setColorFill(BaseColor.RED);
canvas.rectangle(1, 100, 100, 100);
canvas.fill();
canvas.restoreState(); // tried with and without restoring state
}
When drawing the rectangle before adding the table instance to the document,
the rectangle gets overlapped by the table content.
When drawing the rectangle after the table is added to the document,
the rectangle is drawn at a seperate page of the document.
Sorry for being a pest ...
Steria Mummert Consulting AG
Vorsitzender des Aufsichtsrates: Jürgen Sponnagel - Vorstand: Oliver Nazet (Vors.), Dr. Reinhard Liedl, Dr. Fritz Moser
Gesellschaftssitz: Hamburg - HR B 61 116 Amtsgericht Hamburg - USt-ID-Nr.: DE118671351
Bitte denken Sie an Ihre Verantwortung gegenüber der Umwelt: Jede ausgedruckte E-Mail verursacht ca. 0,3 Gramm CO2.
Diese Nachricht kann vertrauliche Informationen enthalten und ist allein für den Adressaten bestimmt. Wenn Sie nicht der rechtmäßige Empfänger sind, ist der Zugriff, die Weiterleitung, das Kopieren, die Veröffentlichung oder anderweitige Verwendung des Inhalts untersagt. In diesem Fall bitten wir Sie den Absender unverzüglich zu informieren und diese E-Mail sowie sämtliche Kopien dieser Email zu löschen. Der Inhalt von E-Mails innerhalb des Netzwerks kann überprüft werden, um die Übereinstimmung mit den geltenden Firmenrichtlinien und Vorgehens-weisen zu gewährleisten. E-Mails können auf dem Transportweg von Dritten verändert werden, so dass deren Vollständigkeit und Echtheit nicht garantiert werden kann.
This Email communication may contain confidential information and is intended only for the recipient. If you are not the intended recipient you are not allowed to read, copy, distribute, publicize or use the content of this Email in any way. Please notify the sender and delete the Email and any copies of it. The content of Emails within our network may be monitored to ensure compliance with company policies and procedures. Emails can be alterated by third parties in transit. Therefore any Email is susceptible to alteration and its integrity cannot be assured.
------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev
_______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.itextpdf.com/book/ Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/
