Hello!
I convert HTML-files to PDF/A and I add page numbers this way before the conversion:
private void insertPageNumbers(Document document) {
int pages = 0;
try {
pages = document.getPageCount();
} catch (Exception e) {
}
if (pages > 1) {
DocumentBuilder builder = new DocumentBuilder(document);
builder.moveToHeaderFooter(HeaderFooterType.FOOTER_PRIMARY);
builder.getFont().setName("Arial");
builder.getFont().setSize(10);
builder.insertField("PAGE", "");
builder.write(" / ");
builder.insertField("NUMPAGES", "");
builder.getParagraphFormat().setAlignment(ParagraphAlignment.RIGHT);
}
}
This worked fine as long as I converted to PDF_A_1_A. But now, as I convert to PDF_A_2_A, the page numbers are not included in the resulting PDF.
Attached are input HTML and output PDF (PDF_A_1_A and PDF_A_2_A): missingPageNumbers.zip (392.8 KB)
Do you have any ideas why there are no page numbers included in the PDF_A_2_A file?
Kind regards!