>The line is drawn from coordinate (100, 400) to coordinate (100, 800). 
> This is a vertical line almost 1 inch and a half from the left border,
> going from approximately half the page to almost the top of the page
> (if you're working with A4).

> If you expect a horizontal line, you shouldn't draw a vertical one.

Well, of course. I changed the code to:
 b.LineWidth = 1f;
cb.moveTo(35, pdfWriter.getVerticalPosition(false));
cb.lineTo(600, pdfWriter.getVerticalPosition(false));
cb.stroke();

The problem is, that the line is drawed as the first element of the pdf 
document and not at the position as expected. Is it because the Chapter, 
Sections, ... I created before creating/drawing the line are still in 
memory and I didn't add the Chapter to the document before trying to draw 
the line?

You know: I have one big Chapter adding Sections to it (to get numbering). 
In one Section I want to draw the line following further sections. After 
completing cunstructing all sections I want to add the Chapter to the 
Document.

Regards
Dirk
>             -------- Original-Nachricht --------
> Datum: Thu, 23 Nov 2006 21:28:19 +0100
> Von: Bruno Lowagie <[EMAIL PROTECTED]>
> An: Post all your questions about iText here 
> <[email protected]>
> Betreff: Re: [iText-questions] How to draw a horizontal line at a 
> arbitrary psoition?
> 
>             Dirk Ulrich wrote:
> > I am using a Chapter to place subsequent Sections to be able to number 
> > the sections continuously. This works fine.
> 
> OK.
> 
> > Now I want to add a 
> > horizontal line as a divider. How can I do this?
> 
> That's explained in section 14.2 of the book.
> I use the same technique in chapter 7 to draw
> a line that separates different paragraphs.
> 
> > If I use this code:
> > 
> > PdfWriter writer = PdfWriter.getInstance(document, new 
> > FileOutputStream("test.pdf"));
> > PdfContentByte cb = writer.DirectContent;
>  >
> > cb.LineWidth = 10f;
> > cb.moveTo(100, 400);
> > cb.lineTo(100, 800);
> > cb.stroke();
> > 
> > The line is placed not at the desired/expected position within the 
> section.
> 
> The line is drawn from coordinate (100, 400) to coordinate (100, 800). 
> This is a vertical line almost 1 inch and a half from the left border,
> going from approximately half the page to almost the top of the page
> (if you're working with A4).
> 
> If you expect a horizontal line, you shouldn't draw a vertical one.
> This is all explained by example in the free online tutorial.
> It is explained in extenso in the book.
> 
> 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/
> 
        
-- 
Mit freundlichen Grüßen

Dirk Ulrich
Jansenstraße 21
13437 Berlin
fon:0++49-(0)30-40 999 087
mobil:++49-(0)174/948 87 39

"Ein Herz für Kinder" - Ihre Spende hilft! Aktion: www.deutschlandsegelt.de
Unser Dankeschön: Ihr Name auf dem Segel der 1. deutschen America's Cup-Yacht!
-------------------------------------------------------------------------
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