Good day everyone!
I have some questions regarding document:
- Does itextpdf have the option to have a different margin on a specific page? I have tried to use
document.setMargin
then
document.newPage
but it seems that every page get the same margin.
- Is there any way to prevent header and element from overlapping?
Thanks!
EDIT
Here is the method that adds the document content:
@Override
void addDocumentContent(Document doc, PdfWriter writer, AbstractDiplomaDataModel diplomaData) throws DiplomaPdfFileProducerException {
try {
doc.setMargins(DefaultPdfDocumentSettings.LEFT_MARGIN, DefaultPdfDocumentSettings.RIGHT_MARGIN, 0f, 0f);
doc.newPage();
doc.add(new DiplomaPdfDataGenerator(diplomaData).generateFirstPagePdf());
doc.setMargins(DefaultPdfDocumentSettings.LEFT_MARGIN, DefaultPdfDocumentSettings.RIGHT_MARGIN, DefaultPdfDocumentSettings.TOP_MARGIN,DefaultPdfDocumentSettings.BOTTOM_MARGIN);
doc.newPage();
doc.add(new DiplomaPdfDataGenerator(diplomaData).generateOtherPagesPdf());
} catch (Exception e) {
throw new DiplomaPdfFileProducerException(e.getMessage());
}
}
and this is the result: