I have a paragraph in which I'm including an inline image using the code below. There are some cases, however, where the image height is larger than the line spacing. From the JavaDoc, it appears that the constructor Chunk(Image image, float offsetX, float offsetY, boolean changeLeading) would handle this, however as you can see from the attached pdf, the line spacing is not adjusted.
Can someone please tell me what I'm doing wrong? As always, thanks for your help! Jerry import java.io.*; import com.lowagie.text.*; import com.lowagie.text.pdf.*; public class imageTest { public static void main(String[] args) { Document document = new Document(PageSize.A4, 50, 50, 50, 50); try { PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("c:\\image_leading.pdf")); String myString = "<itext><p></p></itext>"; document.open(); Paragraph p = new Paragraph(); p.add(new Chunk("Here is some text and an image will appear inline with the test test here ... blah blah blah blah")); Image img = Image.getInstance("C:/myimage.gif"); p.add(new Chunk(img,0,0, true)); p.add(new Chunk("blah blah blah blah blah blah blah")); document.add(p); document.close(); System.out.println("Finished."); } catch (Exception de) { de.printStackTrace(); } } }
image_leading.pdf
Description: image_leading.pdf