Mike Buchanan wrote:

> This may be what I need but it’s not working.

You shouldn't expect your code to work, because
this line is all wrong:

>        PdfContentByte[] canvas = new PdfContentByte(); 

The next few lines don't make sense either:

>        PdfContentByte cb = canvas[PdfPTable.TEXTCANVAS];
>        cb.setRGBColorStroke(0x00, 0x00, 0xFF);

How is the code above related to the code below?
(It doesn't.)

>        Paragraph commentPara = new Paragraph();
>        commentPara.setLeading(11f);
>        commentPara.add (new Phrase(commentStr.trim(), new 
> Font(Font.HELVETICA, 9, Font.BOLD, new CMYKColor(0f, 0f, 0f, 1f))));
>        PdfPCell commentCell = new PdfPCell();
>        commentCell.setBorder(Rectangle.NO_BORDER);
>        commentCell.addElement(commentPara);
>        detailTable.addCell(commentCell);
>        doc.add(detailTable);

> The compiler doesn’t recognize the array constructor of 
> PdfContentByte[].

The opposite would have surprised me.

>  Also, I can’t see how the canvas can overlay the table.

Me neither ;-)

> If anyone gets a chance after they get up off the floor from laughing at 
> my code, I’d appreciate any input I can get.

You can't create the array with the different canvases yourself.
iText creates them internally and passes this array to your
implementation of the cell or table event interface.

If you want different layers in a cell, you should write a custom
cell (or table) event class, create an instance of this custom class,
and pass it to the cell (or table).
When iText renders the cell to PDF syntax, it will notice that a cell
(or table) event was added, and pass a PdfContentByte array to your
custom method. Un the book I have a method that draws an ellipse,
one that strikes through the content of the cell, another one that
draws a border with rounded corners. All this using one of the
canvases and the coordinates that are passed to the method.

br,
Bruno

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to