I thank you for your expertise. 

 - John. 

-----Original Message-----
From: Balder VC [mailto:li...@redlab.be] 
Sent: August 3, 2011 1:29 PM
To: itext-questions@lists.sourceforge.net
Subject: Re: [iText-questions] Computing page size from Table - iText
v1.4.5

On 3/08/2011 18:15, 1T3XT BVBA wrote:
> On 3/08/2011 18:02, Balder VC wrote:
>> In your calculations you do not take the documents default margins 
>> into account. That's the issue.
> Are you sure?

Forgot to mention I changed the

calculateHeightsFast() by removing Fast, and added
doc.setMargins(0,0,0,0) as tests

The result was 1 page (with the table stretched though I think, I didn't
check if that was the right table width), Thought that was sufficient
enough.

But
      result.setLockedWidth(true);
      result.getTotalHeight();
is a better solution and will work for all tables imo !

>
> I just ran the code, and I noticed two errors:
>
> 1. The calculateHeightsFast() method is no longer present in the 
> latest iText releases.
>       Whoever uses it, didn't read the book, because the book tells 
> you to use getTotalHeigh().
> 2. The book clearly states that iText can't calculate the heights if 
> it doesn't know the widths.
>       I see setTotalWidth(PageSize.LETTER.getWidth()), but as you can 
> read in the book that
>       method is useless unless (1) you add setLockedWidth(true), or 
> (2) add the table at an
>       absolute position.
>
> In short, if I replace the line:
>       result.calculateHeightsFast();
> with:
>       result.setLockedWidth(true);
>       result.getTotalHeight();
> I don't see any problem.
>
> My apologies for this answer. It's completely useless and 
> inappropriate, unless...
> Unless there's a lesson learned: first read the book, then write your 
> code ;-)
I don't know the book by heart like you :)
>
> ----------------------------------------------------------------------
> -------- BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, 
> CA The must-attend event for mobile developers. Connect with experts.
> Get tools for creating Super Apps. See the latest technologies.
> Sessions, hands-on labs, demos&  much more. Register early&  save!
> http://p.sf.net/sfu/rim-blackberry-1
> _______________________________________________
> iText-questions mailing list
> iText-questions@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
> iText(R) is a registered trademark of 1T3XT BVBA.
> Many questions posted to this list can (and will) be answered with a 
> reference to the iText book: http://www.itextpdf.com/book/ Please 
> check the keywords list before you ask for examples: 
> http://itextpdf.com/themes/keywords.php


------------------------------------------------------------------------
------
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA The
must-attend event for mobile developers. Connect with experts. 
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a
reference to the iText book: http://www.itextpdf.com/book/ Please check
the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php

------------------------------------------------------------------------------
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts. 
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to