Inthebrowseritlosestheconfigurationoftheboxandgoesyellowasanote:
My question and how can I sign on all pages? and if it's not possible, how do I create a text field or something at the bottom of each page?
Inthebrowseritlosestheconfigurationoftheboxandgoesyellowasanote:
My question and how can I sign on all pages? and if it's not possible, how do I create a text field or something at the bottom of each page?
I was able to solve with the code below:
filename = filename + "_signed.pdf";
File fileToWrite = File.createTempFile(filename, null);
reader = new PdfReader(this.file);
fow = new FileOutputStream(fileToWrite);
stamper = PdfStamper.createSignature(reader, fow, ' filename = filename + "_signed.pdf";
File fileToWrite = File.createTempFile(filename, null);
reader = new PdfReader(this.file);
fow = new FileOutputStream(fileToWrite);
stamper = PdfStamper.createSignature(reader, fow, '%pre%0');
Font fontcabecatable = new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL);
PdfSignatureAppearance appearance = stamper.getSignatureAppearance();
appearance.setLayer2Font(fontcabecatable);
appearance.setLayer2Text(textoAss);
appearance.setSignDate(Calendar.getInstance());
Integer pageCount = Integer.valueOf(reader.getNumberOfPages());
System.out.println("pageCount "+pageCount);
if(position.equals("planoDeEnsino") ) {
textoAss = "\n"+textoAss;
for(int i = 2; i <= pageCount; i++) {
PdfContentByte pcb = stamper.getUnderContent(i);
Paragraph p = new Paragraph(textoAss);
p.setFont(fontcabecatable);
p.setLeading((float) 10);
ColumnText ct = new ColumnText(pcb);
ct.setSimpleColumn(positionSignature(position));
ct.addElement(p);
ct.go();
}
}
appearance.setVisibleSignature(positionSignature(position),pagina, null);
0');
Font fontcabecatable = new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL);
PdfSignatureAppearance appearance = stamper.getSignatureAppearance();
appearance.setLayer2Font(fontcabecatable);
appearance.setLayer2Text(textoAss);
appearance.setSignDate(Calendar.getInstance());
Integer pageCount = Integer.valueOf(reader.getNumberOfPages());
System.out.println("pageCount "+pageCount);
if(position.equals("planoDeEnsino") ) {
textoAss = "\n"+textoAss;
for(int i = 2; i <= pageCount; i++) {
PdfContentByte pcb = stamper.getUnderContent(i);
Paragraph p = new Paragraph(textoAss);
p.setFont(fontcabecatable);
p.setLeading((float) 10);
ColumnText ct = new ColumnText(pcb);
ct.setSimpleColumn(positionSignature(position));
ct.addElement(p);
ct.go();
}
}
appearance.setVisibleSignature(positionSignature(position),pagina, null);