Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » iText »

[iText-questions] Problem with ColumnText

Andreas Meyer

2005-06-21


Hi all,

I am looking for an elegant way to place and label objects like a
"roundRectangle" using ColumnText.

My current solution is to use a scaled transparent 1x1 gif (provided with
setGenericTag) as *placeholder* and draw/label my objects, after the exact
position is determined.

Snippet1:
...
Image img = Image.getInstance("transparent.gif"); // 1x1
img.scaleAbsolute(desired_width, desired_height);
Chunk myChunk = new Chunk(img, 0, 0);
myChunk.setGenericTag("Information_about_Objecttype_and_Objectlabel");
P.add(myChunk);
...

Snippet2:
...
public void onGenericTag(PdfWriter writer, Document document, Rectangle rect,
String text)
{
  cb = writer.getDirectContent();
  ...
  cb.roundRectangle(rect.left(), rect.bottom(), ...);
  ...
  ClmnTxt.showTextAligned(cb, ..., new Phrase(getLabelfromGenericTag(text),
getFontinfofromGenericTag(text)), rect.left()+ getOffsetXfromGenericTag(text),
rect.bottom() + getOffsetYfromGenericTag(text), 0);
  ...
}
...

Is there a better way to get objects with dynamic shape/size/color/label which
work together with ColumnText ?

Best regards,
Andreas Meyer




-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
iText-questions mailing list
iText-questions@(protected)
https://lists.sourceforge.net/lists/listinfo/itext-questions
©2008 junlu.com - Jax Systems, LLC, U.S.A.