|
View:
New views
6 Messages
—
Rating Filter:
Alert me
|
|
|
Further Testing - RE: Confusing Cell Hight numbersOk, I have done some further testing and have found the following possible bug... When generating a table the first time a row is created within a for loop, the cell height is really messed up. I even tried creating a row before the for loop and it cell height is correct but the next one (first in the for loop) is again way off. I have attached the generated pdf, the test code sample and the java console log. Can someone take a look and see if maybe I did something wrong or maybe iText support can use this as an example to figure out what is going wrong. Thank You.. Glen Hamel Lead Programmer / Technician Auric Networks Canada, Inc. 570 Orwell Street, Unit 1 Mississauga, Ontario L5A 3V7 Phone 905.361.7621 Fax 905.274.3912 http://www.auricnet.ca |
||||||||
|
|
Re: Further Testing - RE: Confusing Cell Hight numbersThis is getting as mysterious as the tiffs that fail in Linux. I'll have
a look. Paulo > -----Original Message----- > From: itext-questions-bounces@... > [mailto:itext-questions-bounces@...] On > Behalf Of glen.hamel@... > Sent: Thursday, May 15, 2008 5:50 PM > To: iText-questions@... > Subject: [iText-questions] Further Testing - RE: Confusing > Cell Hight numbers > > > Ok, I have done some further testing and have found the > following possible bug... > > When generating a table the first time a row is created > within a for loop, the cell height is really messed up. > I even tried creating a row before the for loop and it cell > height is correct but the next one (first in the for loop) is > again way off. > I have attached the generated pdf, the test code sample and > the java console log. > Can someone take a look and see if maybe I did something > wrong or maybe iText support can use this as an example to > figure out what is going wrong. > > Thank You.. > > > > Glen Hamel > Lead Programmer / Technician > Auric Networks Canada, Inc. > 570 Orwell Street, Unit 1 > Mississauga, Ontario > L5A 3V7 > > Phone 905.361.7621 > Fax 905.274.3912 > > http://www.auricnet.ca <http://www.auricnet.ca/> > Aviso Legal: Esta mensagem é destinada exclusivamente ao destinatário. Pode conter informação confidencial ou legalmente protegida. A incorrecta transmissão desta mensagem não significa a perca de confidencialidade. Se esta mensagem for recebida por engano, por favor envie-a de volta para o remetente e apague-a do seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de usar, revelar ou distribuir qualquer parte desta mensagem. Disclaimer: This message is destined exclusively to the intended receiver. It may contain confidential or legally protected information. The incorrect transmission of this message does not mean the loss of its confidentiality. If this message is received by mistake, please send it back to the sender and delete it from your system immediately. It is forbidden to any person who is not the intended receiver to use, distribute or copy any part of this message. ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ iText-questions mailing list iText-questions@... https://lists.sourceforge.net/lists/listinfo/itext-questions Do you like iText? Buy the iText book: http://www.1t3xt.com/docs/book.php Or leave a tip: https://tipit.to/itexttipjar |
||||||||
|
|
Re: Further Testing - RE: Confusing Cell Hight numbersThere's no bug, the problem is in your code. You call setTotalWidth()
with a value unrelated to the page size. The first time it loops the width is 24 but as you didn't call setLockedWidth() the width is reset to the page width, about 590, when the table is added to the doc. In the second and subsequent loops the width is the one used when added to the page, about 590. This result in different values. You should use setLockedWidth() for this kind of usage. Paulo > -----Original Message----- > From: itext-questions-bounces@... > [mailto:itext-questions-bounces@...] On > Behalf Of glen.hamel@... > Sent: Thursday, May 15, 2008 5:50 PM > To: iText-questions@... > Subject: [iText-questions] Further Testing - RE: Confusing > Cell Hight numbers > > > Ok, I have done some further testing and have found the > following possible bug... > > When generating a table the first time a row is created > within a for loop, the cell height is really messed up. > I even tried creating a row before the for loop and it cell > height is correct but the next one (first in the for loop) is > again way off. > I have attached the generated pdf, the test code sample and > the java console log. > Can someone take a look and see if maybe I did something > wrong or maybe iText support can use this as an example to > figure out what is going wrong. > > Thank You.. > > > > Glen Hamel > Lead Programmer / Technician > Auric Networks Canada, Inc. > 570 Orwell Street, Unit 1 > Mississauga, Ontario > L5A 3V7 > > Phone 905.361.7621 > Fax 905.274.3912 > > http://www.auricnet.ca <http://www.auricnet.ca/> > Aviso Legal: Esta mensagem é destinada exclusivamente ao destinatário. Pode conter informação confidencial ou legalmente protegida. A incorrecta transmissão desta mensagem não significa a perca de confidencialidade. Se esta mensagem for recebida por engano, por favor envie-a de volta para o remetente e apague-a do seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de usar, revelar ou distribuir qualquer parte desta mensagem. Disclaimer: This message is destined exclusively to the intended receiver. It may contain confidential or legally protected information. The incorrect transmission of this message does not mean the loss of its confidentiality. If this message is received by mistake, please send it back to the sender and delete it from your system immediately. It is forbidden to any person who is not the intended receiver to use, distribute or copy any part of this message. ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ iText-questions mailing list iText-questions@... https://lists.sourceforge.net/lists/listinfo/itext-questions Do you like iText? Buy the iText book: http://www.1t3xt.com/docs/book.php Or leave a tip: https://tipit.to/itexttipjar |
||||||||
|
|
Re: Further Testing - RE: Confusing Cell Hight numbersglen.hamel@... wrote:
> > Ok, I have done some further testing and have found the following > possible bug... It's NOT a bug; it's wrong use of iText. You didn't understand Paulo's advice: "PdfPTable.getRowHeight(). You must set the total width first." I don't know if you already have the book, but the combination of these two lines doesn't make sense: doutTable.setWidthPercentage(100); doutTable.setTotalWidth(24.0f); Either you want to set the width as a percentage (100%) or you want to set the width absolutely, but in your case the second line is ignored, because you didn't do: doutTable.setLockedWidth(true); And even if you add that line, it would lead to a very ugly result because 24pt is very small for a table. What you need is: doutTable.setTotalWidth(document.right() - document.left()); doutTable.setLockedWidth(true); If the "width" is "locked", iText knows it should use that value AND it will ignore the width percentage (so you might as well drop that line). So far for the solution to your problem. Now for your allegation that this is a bug in iText. It would go against any logic if iText was able to get the height of the first row right in your example. That would be simply impossible! (And "in this house we obey the rules of thermodynamics!") Why impossible? Well, you create a table object with a width of 100%. Then you add enough cells to fit one row and you ask the height of that row. But you didn't add the table to the document yet! There is no way for the table to know the available width. It's 100% of what? Of 24pt? By the way, where did you get that value? It looks like you chose a number arbitrarily. The table object can't know this until you add the table to the document. At that moment, you commit that table to a specific document, with a specific width (document.right() - document.left()) and because of that, the height of the rows following that first row can be calculated correctly. best regards, Bruno ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ iText-questions mailing list iText-questions@... https://lists.sourceforge.net/lists/listinfo/itext-questions Do you like iText? Buy the iText book: http://www.1t3xt.com/docs/book.php Or leave a tip: https://tipit.to/itexttipjar |
||||||||
|
|
Re: Further Testing - RE: Confusing Cell Hight numbers
=>glen.hamel@... wrote: =>> =>> Ok, I have done some further testing and have found the following =>> possible bug... => =>It's NOT a bug; it's wrong use of iText. =>You didn't understand Paulo's advice: =>"PdfPTable.getRowHeight(). You must set the total width first." => =>I don't know if you already have the book, but =>the combination of these two lines doesn't make sense: => =>doutTable.setWidthPercentage(100); =>doutTable.setTotalWidth(24.0f); :) Your right Bruno, I didn't quite understand the difference between the two. Now I do.. :) The Book just arrived last night and I plan on reading it over the weekend.. :) But I will say this, before I had the setTotalWidth, I would not be able to calculate the row height. Once I added the setTotalWidth I was able to get the row Height. No need to comment on these last 2 lines as I see the errors of my way.. :) =>Either you want to set the width as a percentage (100%) =>or you want to set the width absolutely, but in your case =>the second line is ignored, because you didn't do: => =>doutTable.setLockedWidth(true); => =>And even if you add that line, it would lead to a very ugly =>result because 24pt is very small for a table. => =>What you need is: => =>doutTable.setTotalWidth(document.right() - document.left()); =>doutTable.setLockedWidth(true); => =>If the "width" is "locked", iText knows it should use that value =>AND it will ignore the width percentage (so you might as well =>drop that line). => =>So far for the solution to your problem. Thank you so much that now makes perfect sense, I am not sure why I missed it... =>Now for your allegation that this is a bug in iText. I do want to point out I said "possible bug", as in I was not sure if it was me or iText.. Now I know it was me.. :) => =>It would go against any logic if iText was able to get the height =>of the first row right in your example. That would be simply =>impossible! (And "in this house we obey the rules of thermodynamics!") That is strange because as soon as I created the last cell in that row and added it to the table, I am able to get the height.. Hmmm, I have some re-thinking to do here.. => =>Why impossible? Well, you create a table object with a width of 100%. =>Then you add enough cells to fit one row and you ask the =>height of that row. But you didn't add the table to the document yet! =>There is no way for the table to know the available width. It's 100% =>of what? Of 24pt? By the way, where did you get that value? It looks No the number wasn't arbitrarily chosen.. When I created the table with widths "float[] widths3 = {0.5f, 6.0f, 1.0f, 1.0f};" and I printed a page that looked perfect, I used a ruler and did some calculations and arrived at that number.. 2 cm = 1.2f so a page being 21.5 cm is about 24.0f.. Obviously that was WAY off.. After reading what you just pointed out, I see my errors.. Now that I have the book I will be prone to making less of these stupid errors. =>like you chose a number arbitrarily. The table object can't know this =>until you add the table to the document. At that moment, you commit =>that table to a specific document, with a specific width =>(document.right() - document.left()) and because of that, =>the height of the rows following that first row can be calculated =>correctly. => =>best regards, =>Bruno => =>------------------------------------------------------------------------- =>This SF.net email is sponsored by: Microsoft =>Defy all challenges. Microsoft(R) Visual Studio 2008. =>http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ =>_______________________________________________ =>iText-questions mailing list =>iText-questions@... =>https://lists.sourceforge.net/lists/listinfo/itext-questions => =>Do you like iText? =>Buy the iText book: http://www.1t3xt.com/docs/book.php =>Or leave a tip: https://tipit.to/itexttipjar Glen Hamel Lead Programmer / Technician Auric Networks Canada, Inc. 570 Orwell Street, Unit 1 Mississauga, Ontario L5A 3V7 Phone 905.361.7621 Fax 905.274.3912
|
||||||||
|
|
Re: Further Testing - RE: Confusing Cell Hight numbersglen.hamel@... wrote:
> I do want to point out I said "possible bug", as in I was not sure if it > was me or iText.. Now I know it was me.. :) No problem. Since I wrote the book, I have the (bad) habit of lecturing; giving long answers to short questions. Sometimes I give the impression of being harsh, but in real life, I'm completely different ;-) br, Bruno ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ iText-questions mailing list iText-questions@... https://lists.sourceforge.net/lists/listinfo/itext-questions Do you like iText? Buy the iText book: http://www.1t3xt.com/docs/book.php Or leave a tip: https://tipit.to/itexttipjar |
| Free Forum Powered by Nabble | Forum Help |