That's a difficult problem. At the time of writing the Paragraph the current
leading may be the Paragraph leading or not. I don't know what the correct
approach should be (read the next Paragraph leading?).
Best Regards,
Paulo Soares
----- Original Message -----
From: "Francois Gravel" <[EMAIL PROTECTED]>
To: "itext-questions" <[EMAIL PROTECTED]>
Sent: Wednesday, July 10, 2002 14:10
Subject: [iText-questions] Paragraph not respecting bottom margin
> Hi All,
>
> I noticed I could get a multilined paragraph to go
> over the bottom margin (see test code below). It's
> only when the paragraph has already started I get this
> error. I couldn't get a paragraph to start past the
> bottom margin.
>
> It looks like this test:
> if (currentHeight + line.height() < indentTop() -
> indentBottom()) {
> in PdfDocument.carriageReturn() is not taking into
> account the paragraph leading as part of the line
> height. I changed the test to (currentHeight +
> line.height() + leading < indentTop() -
> indentBottom()) and the paragraph now behaves as (I)
> expected.
>
> You can see the full source code and the pdf there:
> http://www.fgravel.com/itext/BottomMargin.java.txt
> http://www.fgravel.com/itext/BottomMargin.pdf
>
> == TEST CODE ==
> Document document = new Document(PageSize.LETTER);
> PdfWriter writer = PdfWriter.getInstance(document, new
> FileOutputStream("c:\\pdf\\BottomMargin.pdf"));
> document.setMargins(72, 72, 40, 72);
> document.open();
>
> PdfPTable table = new PdfPTable(1);
> table.addCell("Hello");
> table.setTotalWidth(6.5f*72);
> table.writeSelectedRows(0,-1,72,72,writer.getDirectContent());
>
> StringBuffer buf = new StringBuffer();
> for ( int i=0; i<60; ++i)
> buf.append("Hello World ");
> buf.append("END");
> Font f = new Font(Font.HELVETICA, 8);
> for ( int i=0; i<40; ++i ) {
> document.add(new Paragraph(buf.toString(),f));
> }
> document.close();
>
> I was surprised to see this behavior, so please let me
> know if I'm doing anything wrong.
>
>
> Thanks
>
> Francois.
>
> __________________________________________________
> Do You Yahoo!?
> Sign up for SBC Yahoo! Dial - First Month Free
> http://sbc.yahoo.com
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Two, two, TWO treats in one.
> http://thinkgeek.com/sf
> _______________________________________________
> iText-questions mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Two, two, TWO treats in one.
http://thinkgeek.com/sf
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions