private void AddText(iTextSharp.text.Font iFont, float ptLeft, float ptTop, float ptHeight, float ptWidth, int alignment, string toPrint)
{
PdfContentByte cb = _writer.DirectContent;
ColumnText ct = new ColumnText(cb);
ct.SetSimpleColumn(new Paragraph(toPrint, iFont), ptLeft, ptTop - ptHeight, ptLeft + ptWidth, ptTop - ptHeight, 0, alignment);
ct.Go();
}
private void AddLine(float x, float y, float height, float width, float thickness, LineDirection direction)
{
PdfContentByte cb = _writer.DirectContent;
cb.SetLineWidth(thickness);
if (direction == LineDirection.Horizontal)
{
cb.MoveTo(x, y);
cb.LineTo(x + width, y);
}
else
{
cb.MoveTo(x, y);
cb.LineTo(x, y + height);
}
cb.ClosePathStroke();
}
-----Original Message-----
From: Paulo Soares [mailto:
psoares@...]
Sent: Friday, June 26, 2009 4:32 PM
To: Post all your questions about iText here
Subject: Re: [iText-questions] How can I keep text from interfering with linedrawings/shapes?
Code, please.
Paulo
----- Original Message -----
From: "Justin Griffiths" <
jggriffiths@...>
To: <
itext-questions@...>
Sent: Friday, June 26, 2009 10:34 PM
Subject: [iText-questions] How can I keep text from interfering with
linedrawings/shapes?
Using iTextSharp, I am creating PDFs of absolutely positioned text
(SetSimpleColumn) and lines. It seems that the text is shifting the
position of some lines. When I remove all of the text, the lines return to
their proper location. This is unexpected behavior.
I've tried using DirectContentUnder to draw the lines under the text, but
this doesn't seem to have any real effect - except that the text does appear
over the lines.
How can I draw lines that will not move or shift position with regards to
text?
Thank you in advance for any help you can offer.
JG
------------------------------------------------------------------------------
_______________________________________________
iText-questions mailing list
iText-questions@...
https://lists.sourceforge.net/lists/listinfo/itext-questionsBuy the iText book:
http://www.1t3xt.com/docs/book.phpCheck 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/This email is intended solely for the recipient. It may contain privileged, proprietary or confidential information or material. If you are not the intended recipient, please delete this email and any attachments and notify the sender of the error.
------------------------------------------------------------------------------
_______________________________________________
iText-questions mailing list
iText-questions@...
https://lists.sourceforge.net/lists/listinfo/itext-questionsBuy the iText book:
http://www.1t3xt.com/docs/book.phpCheck 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/