Bruno, thanks for your help with this. I was just going over your reply
and I might not have been clear or I'm just confused, but can I
successfully draw a line (an Html HR style line) using generic tag
events? In the example that I attached previously I was trying to use
generic tag events and you responded with something different. I need to
be able to do something similar to the old Graphic class which was being
used to draw the HR line. I was hoping that generic tag events would do
it, but I can't get the rectangle passed into the OnGenericTag event to
give the right dimensions.

I am attaching a different example this time. This example is adding a
"HR" line to a cell in a table. The line should be drawn to span the
cell the chunk (w/a generic tag set) is in. The problem is that the
rectangle has a width of 0 (because the chunk has nothing in it) in the
OnGenericTag method.

How else can I generate an HR style line if a generic tag won't work?
The reason the Graphic class worked so well we that it allowed the
object be added to ColumnText without needing to know the exact length
by using a percent. I was hoping to get the same effect using the
generic tag method.

Hope that wasn't too long and was somewhat coherent.

Thanks for the help,
-Mitch

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Mitch Freed
Sent: Tuesday, March 06, 2007 11:37 AM
To: Post all your questions about iText here
Subject: Re: [iText-questions] HR Using PageEvent vs DeprecatedGraphic
Object

Thanks for the reply. The problem I had using document.Right and
document.Left was that it didn't match the current column (e.g. 300
specified by SetSimpleColumn()) width. The document width could be 612,
but the current column width is 300, so document.Right would span the
page and not the column, resulting in the line spanning the page and not
the column. 

My workaround is to call a method to keep track of the current column
width every time I call SetSimpleColumn so that the PageEvent handler
always knows the current "page" (column) width. It would be nice though
if I could get the rectangle or document passed into OnGenericTag to
represent the actual width of the current column specified by
ColumnText.

Hope that makes sense.

Thanks.

-Mitch

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Bruno Lowagie
Sent: Tuesday, March 06, 2007 11:23 AM
To: Post all your questions about iText here
Subject: Re: [iText-questions] HR Using PageEvent vs DeprecatedGraphic
Object

Mitch Freed wrote:
> And here is a sample CS file.
You need some more Go()s and the method getYLine() (or YLine in C#???)
See below (and adapt to C#):

ColumnText ct = new ColumnText(cb);
ct.SetSimpleColumn(document.Left, document.Bottom, 300f, document.Top);

Paragraph p  =new Paragraph(float.NaN, "");                     
p.SetAlignment("left");
p.Add(new Chunk("This is some lame text. This is some lame text. This is
some lame text. This is some lame text. This is some lame text. This is
some lame text. This is some lame text. This is some lame text. This is
some lame text. This is some lame text.")); ct.AddElement(p); ct.Go();

cb.SaveState();
cb.SetLineWidth(1f);
cb.SetColorStroke(Color.BLACK);
cb.MoveTo(document.Left, ct.getYLine()); cb.LineTo(document.Right,
ct.getYLine()); cb.Stroke(); cb.RestoreState();

Paragraph p2 = new Paragraph(float.NaN, ""); p2.SetAlignment("left");
p2.Add(new Chunk("This is some more lame text. This is some more lame
text. This is some more lame text. This is some more lame text. This is
some more lame text. This is some more lame text. This is some more lame
text. This is some more lame text.")); ct.AddElement(p2); ct.Go();

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=DEVDE
V
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
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=DEVDE
V
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Attachment: Program.cs
Description: Program.cs

-------------------------------------------------------------------------
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
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to