Why PdfStamper increase the size of my signed pdfs every i use?
That's my code:
private static void test(String src, String pwd, String dest) throws Exception {
byte[] pwdByte = pwd != null ? pwd.getBytes() : null;
PdfReader r = null;
PdfStamper stp = null;
FileOutputStream fos = null;
try {
r = new PdfReader(src, pwdByte);
fos = new FileOutputStream(dest);
stp = new PdfStamper(r, fos, '\0', true);
} finally {
stp.close();
fos.close();
r.close();
}
}
If i call test, the resulting pdf increases the size depending on the signed info:
My initial pdf has a LTV sign but i need to add a timestamp. I need to addLtv() some pdfs and later addLtvNoTs() because it's a different TSA. This makes calling twice PdfReader in mode append and every time i do it increases my pdf in 190kb aprox. That means increasing it 380kb. http://developers.itextpdf.com/question/how-enable-ltv-timestamp-signature
I've tested calling above test method with a pdf with a simple sing and every time i call test() on the resulting pdf it increase 3,5kb each time (i think due to small sign info).
Why pdfstamper increase my pdf size if it's signed even i don't add any change? How can i avoid it? 390kb it's a problem because i need to resign thousand of pdfs and store them.
I'm using itext 5.5.9
Thanks in advance!