I attempted to utilize the following HTML template in an effort to convert it to a PDF using iText7, however, I am facing an issue where both the header and footer are not aligning to their designated positions. You can view the example I used here. I am steering away from using the @Page header and footer properties as I am aiming to accommodate dynamic content in both sections with more than 3 rows of extended space.
Below is the iText code snippet along with the result:
ConverterProperties properties = new ConverterProperties();
//properties.setFontProvider(fontProvider);
properties.setMediaDeviceDescription(new MediaDeviceDescription(MediaType.PRINT));
PdfWriter writer = new PdfWriter("out.pdf");
PdfDocument pdf = new PdfDocument(writer);
pdf.setTagged();
PageSize pageSize = PageSize.LETTER;
pdf.setDefaultPageSize(pageSize);
OutlineHandler outlineHandler = OutlineHandler.createStandardHandler();
properties.setOutlineHandler(outlineHandler);
//html template (templateOutput)
HtmlConverter.convertToPdf(templateOutput, pdf, properties);
byte[] pdfData = byteArrayOutputStream.toByteArray();
pdf.close();
Any suggestions on how to address this issue would be greatly appreciated. Thank you.