That worked! Thanks for the quick reply!

Jerry

-----Original Message-----
From: Paulo Soares [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 30, 2004 10:57 AM
To: Jerry Heinz; [EMAIL PROTECTED]
Subject: RE: [iText-questions] Image Sizing in PdfPCells


You aren't doing anything wrong, Image.setWidthPercentage(0) will honor
the image dimensions and scaling.


> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Jerry Heinz
> Sent: Tuesday, November 30, 2004 3:21 PM
> To: [EMAIL PROTECTED]
> Subject: [iText-questions] Image Sizing in PdfPCells
> 
> Greetings all! I have a question about image sizing inside of
> PdfPCells.
> 
> I have multiple XML docs that I format and merge into a
> single document.
> To facilitate this, I'm using a modified version of
> com.lowagie.text.xml.SAXiTextHandler that adds elements to a Vector
> rather than directly to the document. This produces a list that I then
> loop through to add Elements to the document (Elements are added to a
> single PdfPCell that belongs to a table that controls things like
> borders and margins). I am having trouble with the size of images as
> they are added to the PdfPCell - the images expand to fill the total
> width of the table, thus distorting any images that are 
> smaller than the
> table's width. I've tried setting the image width manually and
> encapsulating the Image within another PdfPTable whose width is set.
> Here is the current version of my loop:
> 
>               // Create a new cell. Write the chunks from the vector
> to the cell.
>               PdfPCell cell = new PdfPCell();
>               for (Iterator i = elementVector.iterator();
> i.hasNext();){
>                       Element myElement = (Element)i.next();
>                       
>                       // Chunks can't be added directly to a PdfPCell,
> so we encapsulate
>                       if (myElement instanceof Chunk) {
>                               cell.addElement(new
> Paragraph((Chunk)myElement));
>                       
>                       // Handle any images
>                       } else if (myElement instanceof Image) {
>                               PdfPTable imgTable = new PdfPTable(1);
>       
> imgTable.setTotalWidth(((Image)myElement).plainWidth());
>                               imgTable.addCell((Image)myElement);
>                               cell.addElement(imgTable);
>                       
>                       // All other elements
>                       } else {
>                               cell.addElement(myElement);
>                       }
>               }
>               
>               // Add the cell to the table and the table to the
> document.
>               table.addCell(cell);
> 
> Can someone please tell me what I'm doing wrong? Thanks for your time 
> and help!!!
> 
> Jerry
> 
> 
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from
> real users.
> Discover which products truly live up to the hype. Start reading now. 
> http://productguide.itmanagersjournal.com/
> _______________________________________________
> iText-questions mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> 


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to