Chunk implements Element, IAccessibleElement { public Chunk setGenericTag(final String text) { return setAttribute(GENERICTAG, text); } Chunk();  Chunk(final Chunk ck);  Chunk(final String content, final Font font);  Chunk(final String content);  Chunk(final char c, final Font font);  Chunk(final char c);  Chunk(final Image image, final float offsetX, final float offsetY);  Chunk(final DrawInterface separator);  Chunk(final DrawInterface separator, final boolean vertical); @Deprecated  Chunk(final DrawInterface separator, final float tabPosition); @Deprecated  Chunk(final DrawInterface separator, final float tabPosition, final boolean newline); private  Chunk(final Float tabInterval, final boolean isWhitespace);  Chunk(final Image image, final float offsetX, final float offsetY,
			final boolean changeLeading); boolean process(final ElementListener listener); int type(); List<Chunk> getChunks(); StringBuffer append(final String string); void setFont(final Font font); Font getFont(); String getContent(); @Override String toString(); boolean isEmpty(); float getWidthPoint(); boolean hasAttributes(); boolean hasAccessibleAttributes(); HashMap<String, Object> getAttributes(); void setAttributes(final HashMap<String, Object> attributes); Chunk setHorizontalScaling(final float scale); float getHorizontalScaling(); Chunk setUnderline(final float thickness, final float yPosition); Chunk setUnderline(final BaseColor color, final float thickness, final float thicknessMul,
			final float yPosition, final float yPositionMul, final int cap); Chunk setTextRise(final float rise); float getTextRise(); Chunk setSkew(float alpha, float beta); Chunk setBackground(final BaseColor color); Chunk setBackground(final BaseColor color, final float extraLeft, final float extraBottom,
			final float extraRight, final float extraTop); Chunk setTextRenderMode(final int mode, final float strokeWidth,
			final BaseColor strokeColor); Chunk setSplitCharacter(final SplitCharacter splitCharacter); Chunk setHyphenation(final HyphenationEvent hyphenation); Chunk setRemoteGoto(final String filename, final String name); Chunk setRemoteGoto(final String filename, final int page); Chunk setLocalGoto(final String name); Chunk setLocalDestination(final String name); Chunk setGenericTag(final String text); Chunk setLineHeight(float lineheight); Image getImage(); Chunk setAction(final PdfAction action); Chunk setAnchor(final URL url); Chunk setAnchor(final String url); Chunk setNewPage(); Chunk setAnnotation(final PdfAnnotation annotation); boolean isContent(); boolean isNestable(); HyphenationEvent getHyphenation(); Chunk setCharacterSpacing(final float charSpace); float getCharacterSpacing(); Chunk setWordSpacing(final float wordSpace); float getWordSpacing(); static Chunk createWhitespace(final String content); static Chunk createWhitespace(final String content, final boolean preserve); boolean isWhitespace(); @Deprecated static Chunk createTabspace(); @Deprecated static Chunk createTabspace(float spacing); @Deprecated boolean isTabspace(); PdfObject getAccessibleAttribute(final PdfName key); void setAccessibleAttribute(final PdfName key, final PdfObject value); HashMap<PdfName, PdfObject> getAccessibleAttributes(); PdfName getRole(); void setRole(final PdfName role); AccessibleElementId getId(); void setId(final AccessibleElementId id); boolean isInline(); String getTextExpansion(); void setTextExpansion(String value); static final String OBJECT_REPLACEMENT_CHARACTER; static final Chunk NEWLINE; static final Chunk NEXTPAGE; static final Chunk TABBING; static final Chunk SPACETABBING; static final String SEPARATOR; static final String TAB; static final String TABSETTINGS; static final String HSCALE; static final String UNDERLINE; static final String SUBSUPSCRIPT; static final String SKEW; static final String BACKGROUND; static final String TEXTRENDERMODE; static final String SPLITCHARACTER; static final String HYPHENATION; static final String REMOTEGOTO; static final String LOCALGOTO; static final String LOCALDESTINATION; static final String GENERICTAG; static final String LINEHEIGHT; static final String IMAGE; static final String ACTION; static final String NEWPAGE; static final String PDFANNOTATION; static final String COLOR; static final String ENCODING; static final String CHAR_SPACING; static final String WORD_SPACING; static final String WHITESPACE; }
@Test public void testImageChunkOnGenericTag() throws IOException, DocumentException, InterruptedException { String fileName = "testImageChunkOnGenericTag.pdf"; FileOutputStream fos = new FileOutputStream(OUTFOLDER + fileName); Document doc = new Document(PageSize.LETTER); PdfWriter writer = PdfWriter.getInstance(doc, fos); writer.setPageEvent(new EventHandler()); doc.open(); Image img = Image.getInstance(writer.getDirectContent().createTemplate(100f, 25f)); System.out.println(img.getHeight()); Chunk c = new Chunk(img, 0, 0); c.setGenericTag("foobar"); doc.add(c); doc.close(); CompareTool compareTool = new CompareTool(); String error = compareTool.compareByContent(OUTFOLDER + fileName, SOURCE_FOLDER + "cmp_" + fileName, OUTFOLDER, "diff_"); if (error != null) { Assert.fail(error); } }