Michael, Thanks for your response. Please pardon my ignorance, but what is the document ID and how can I retrieve it?
It seems that PdfEncryption.java has a createDocumentId() method that builds the document ID from some semi-random elements: public static byte[] createDocumentId() { MessageDigest md5; try { md5 = MessageDigest.getInstance("MD5"); } catch (Exception e) { throw new ExceptionConverter(e); } long time = System.currentTimeMillis(); long mem = Runtime.getRuntime().freeMemory(); String s = time + "+" + mem + "+" + (seq++); return md5.digest(s.getBytes()); } Anyway, here is an example file, generated by Documaker, that I am working with. mkl wrote: > > msinatl, > > > msinatl wrote: >> I've got a problem using iText to digitally sign a PDF. The Groovy >> script below works fine with a test PDF I created in Acrobat Pro 7.0. >> But when I run it on a PDF produced by my production document system >> (Oracle Documaker), I get this exception: >> >> java.lang.ArrayIndexOutOfBoundsException: 2 >> at >> com.itextpdf.text.pdf.PdfEncryption.createInfoId(PdfEncryption.java:401) >> >> I'm using iText 5.0.2, JDK 1.6, and Groovy 1.5.6. > > At PdfEncryption.java:401 iText creates the literal representation of a > document ID from a byte[] representation. iText stumbles as the byte[] > parameter is merely 2 bytes long, not 16 as expected. You might want to > look at the ID in your source document. > > (Ok, the code of createInfoId might be made more fool-proof by checking > the byte[] parameter, but for valid PDFs the assumptions implicitely made > here are correct.) > > If that ID looks ok in your document, please forward that document (or any > other one making that issue reproducible) for inspection. > > Regards, Michael. > http://old.nabble.com/file/p28472754/74AA0C69-01F4-4114-6A2D-81D7E7101480-0-IDS-1-BLP.PDF 74AA0C69-01F4-4114-6A2D-81D7E7101480-0-IDS-1-BLP.PDF -- View this message in context: http://old.nabble.com/ArrayIndexOutOfBoundsException-when-signing-Documaker-PDF-tp28466347p28472754.html Sent from the iText - General mailing list archive at Nabble.com. ------------------------------------------------------------------------------ _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.itextpdf.com/book/ Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/