Define a clipping path, in this case a rectangle, before adding the ColumnText.
Paulo ----- Original Message ----- From: "Sam Gibson" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Tuesday, March 27, 2007 10:12 PM Subject: [iText-questions] Trimming Image Overflow (ColumnText?) > Hey all, > > I'm working on a project to produce labels (yes I know it's been > discussed here before, bare with me...). Essentially I have arbitrary > heterogenous (images/text/and potentially other things) elements which > have to be placed at specific points relative to a Cell. > > e.g. > > <img x="10" y="10" height...>...</img> > > Where the x and y attributes are the offset for the current cell. This > isn't too much trouble (with a little help from CellEvents). The problem > is that if an image overflows the bounds of it's cell I want to "trim" > it so that the only visible content is that which is contained in the > cell and the surperflous content doesn't overlap with other cells. > > I was hoping that ColumnText would be the answer to my troubles (as it > does exactly what I want for text), but the addElement method doesn't > seem to have the (my) expected behavior. Here's a snippet of code in the > CellEvent: > > // Add the barcode to the cell (positioned properly). > ColumnText column = new ColumnText(cb); > > // Bind the column to the rectangle of the cell. > column.setSimpleColumn(position.left(), position.bottom(), > position.right(), position.top()); > column.addElement(new Chunk(img, x, -y - height)); > > So, I guess I have two related questions: > > 1) Is what I want to do possible? > 3) How? ;-) > > Thanks, > > Sam Gibson > > ------------------------------------------------------------------------- > 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/ ------------------------------------------------------------------------- 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/
