You can use the following code example to create the table with image and page number field.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.moveToHeaderFooter(HeaderFooterType.FOOTER_PRIMARY);
builder.startTable();
Cell cell = builder.insertCell();
cell.getCellFormat().setPreferredWidth(PreferredWidth.fromPercent(80));
builder.insertImage(MyDir + "image.png")
// Build the second cell
builder.insertCell();
builder.write("Page : ");
builder.insertField(FieldType.FIELD_PAGE, true);
// Call the following method to end the row and start a new row.
builder.endRow();
builder.endTable();
doc.save(MyDir + "19.9.docx");
If you want to use HTML in the footer of document, we suggest you following solution.
Move the cursor to the footer of document using DocumentBuilder.moveToHeaderFooter method.
Insert the HTML using DocumentBuilder.InsertHtml.
Get the table from the footer of document using CompositeNode.GetChild method.
Move the cursor to the second cell table and insert the Page field.