Does the setMargins
method in iText work in a conventional manner?
I have tried the following:
System.out.println(f.exists());
Document document = new Document(PageSize.A4,36,36,36,36);
PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(f.getAbsolutePath()+"0.pdf"));
document.open();
//reader
PdfReader reader = new PdfReader(new FileInputStream(f));
PdfContentByte cb = writer.getDirectContent();
for(int i = 1 ; i < reader.getNumberOfPages()+1 ; i++)
{
System.out.println(f.getName()+" "+i);
PdfImportedPage page = writer.getImportedPage(reader, i);
document.newPage();
cb.addTemplate(page,0,0);
}
// Add your new data / text here
// for example...
//document.add(new Paragraph("my timestamp"));
document.close();
However, I get the same output as my input. I'm wondering whether there is a special trick to getting the setMargins
method to work normally.