It is good to be aware that the width of the cell cannot vary and
setScaleToFitLineWhenOverflow will be of great help.
As for the image it was displaying bad cause the system, which we
are fixing, had an old version of iText:S well this was a bit
embarassing... :P, once we upgraded to 5.0.5 it looked right as we
supposed it should be.
Thanks a lot for your help.
El 27/12/2010 04:45 p.m., Nurettin DAG escribió:
Unfortunately, the width of the cell cannot vary. You
have to define the cell width when defining the PdfPTable. Having
said that if img is wider than the available cell width it will
overflow or may be discarded. Therefore, your image can get as
wide as the width of your cell. To control this behavior you need
to use img.setScaleToFitLineWhenOverflow(true); (note that this is
recently added so only avaliable in the 5.0.5) to scale it to the
width of your cell when it is any wider than that.
As for the height height of cells are not predefined and may vary
freely. The only limitation you run into here is that your image
should not any taller than the page size. That is when it will
overflow. If you use new Chunk(img, 0, 0, true); to place the
image things should look fine for you.
As for limitations, I don't have any for the image size. I
should add the image with "new Chunk(img, 0, 0, true);" as
you said so it keeps its original size.
What I need is to resize the cell so the content is fully
inside of it and it doesn't overlaps other objects outside
the cell or be partially out of the document if the cell is
near one of the borders of the page.
To make it short, I want to resize the cell (mostly height,
image width can be limited we already take that into
account) according to its content as it happens when I add a
Paragraph with text only, being the content a Paragraph with
text and/or images added by using Chunks.
Hope it's clear enough. Let me know any other information
you need.
El 27/12/2010 02:51 p.m., Nurettin DAG escribió:
I may be able to advise on this
but I need to know what your limitations are like "Do
you know what the size of the image should be or do
you want it to fit the line if larger than the width
of full line? What are the limitations for height? Do
you want to keep its original height or resize to line
height?"
To start with if you want to keep image height when
placing image in chunk set the flag changeLeading to
true and it will do it for you. new Chunk(img, 0, 0,
true);
Please explain in detail what you are trying to
achieve for each case.
I need to be able to add images and text to a
PDFPCell resizing it accordingly.
Right now I am using a Paragraph where I add
chunks with images or text to it and finally
adding the paragraph to the cell but the problem
is that the image appears "out of the cell".
This are the results I get:
I add text and images to the cell dinamically
according to some metadata so I need the cell to
automatically resize so that the image appears
completely inside of it.
I am working with iTextSharp.
Thanks in advance.
Johann.
P.D: I apologize for my English as it is not my
first language.
------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC)
One Node allows customers
to consolidate database storage, standardize their
database environment, and,
should the need arise, upgrade to a full
multi-node Oracle RAC database
without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions
--
Nurettin DAG
------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and,
should the need arise, upgrade to a full multi-node Oracle RAC database
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
iText-questions mailing list
[email protected]https://lists.sourceforge.net/lists/listinfo/itext-questions
------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node
allows customers
to consolidate database storage, standardize their database
environment, and,
should the need arise, upgrade to a full multi-node Oracle RAC
database
without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions
------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and,
should the need arise, upgrade to a full multi-node Oracle RAC database
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and,
should the need arise, upgrade to a full multi-node Oracle RAC database
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl