Hello, I tried to enclose a image to a chunk, but the spacing between the lines didn't rise. here is my code:
/* * $Id: ImageChunks.java,v 1.3 2005/05/09 11:52:48 blowagie Exp $ * $Name: $ * * This code is part of the 'iText Tutorial'. * You can find the complete tutorial at the following address: * http://itextdocs.lowagie.com/tutorial/ * * This code is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * [email protected] */ package com.lowagie.examples.objects.images; import java.awt.Color; import java.io.FileOutputStream; import java.io.IOException; import com.lowagie.text.Chunk; import com.lowagie.text.Document; import com.lowagie.text.DocumentException; import com.lowagie.text.Element; import com.lowagie.text.Image; import com.lowagie.text.Phrase; import com.lowagie.text.pdf.PdfPCell; import com.lowagie.text.pdf.PdfPTable; import com.lowagie.text.pdf.PdfWriter; /** * Wrapping Images in a Chunk. */ public class ImageChunks { /** * Images wrapped in a Chunk. * @param args no arguments needed */ public static void main(String[] args) { Document.compress = false; System.out.println("images wrapped in a Chunk"); // step 1: creation of a document-object Document document = new Document(); try { // step 2: // we create a writer that listens to the document // and directs a PDF-stream to a file PdfWriter.getInstance(document, new FileOutputStream("c:/imageChunks.pdf")); // step 3: we open the document document.open(); // step 4: we create a table and add it to the document Image img = Image.getInstance("c:\\ims.jpg"); img.scaleToFit(50, 50); Chunk ck = new Chunk(img, 0, -1); PdfPTable table = new PdfPTable(3); PdfPCell cell = new PdfPCell(); cell.addElement(new Chunk(img, 5, -5)); cell.setBackgroundColor(new Color(0xC0, 0xC0, 0xC0)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell("I see an image\non my right"); table.addCell(cell); table.addCell("I see an image\non my left"); table.addCell(cell); table.addCell("I see images\neverywhere"); table.addCell(cell); table.addCell("I see an image\non my right"); table.addCell(cell); table.addCell("I see an image\non my left"); Phrase p1 = new Phrase("This is an image "); p1.add(ck); p1.add(" just here."); document.add(p1); document.add(p1); document.add(p1); document.add(p1); document.add(p1); document.add(p1); document.add(p1); document.add(table); } catch(DocumentException de) { System.err.println(de.getMessage()); } catch(IOException ioe) { System.err.println(ioe.getMessage()); } // step 5: we close the document document.close(); } } So how is it possible to set the linehight to the size of the image? Thanks for your help. best regards Markus Sticker
imageChunks.pdf
Description: Adobe PDF document
------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev
_______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/
