Hi there, We are very happy users of itext 1.4.8. Our usage is as follows. We take this Government of Canada generated fillable PDF: http://www.cra-arc.gc.ca/E/pbg/tf/t2202a_flat/README.html and then we use the fillable PDF via PdfStamper to fill some AcroFields and then flatten it and present it to our users.
Our users are University students and the data we're filling in the form is tuition amounts and degree related information. Now, I've been lazy in upgrading itext primarly because the late 2.0.x and 2.1 version were not available in the maven repo (did I mention I'm lazy??). In any case, now that 2.0.8 and 2.1.0 are in public repo with all dependencies resolved, I decided to upgrade. I encountered a problem with itext 2.0.3+ where I was getting the infamous "PdfReader not opened with owner password". Looking at: http://itext.ugent.be/library/question.php?id=497 and looking at the source code: if (!reader.isOpenedWithFullPermissions()) throw new IllegalArgumentException("PdfReader not opened with owner password"); What are our options going forward, in your experience? 1. Stay with 2.0.2 for ever 2. Patch itext 2.0.3+ 3. Modify our code??? Any help is appreciated. itext is fully entrenched in our business process now. I can't imagine management would like having to pay mega dollars to start printing/mailing hard copies of T2202As again :-) Our code snippet is supplied below: byte[] byteArray = (byte[]) sc.getAttribute(Constants.T2202A_BYTE_ARRAY_KEY); PdfReader reader = new PdfReader(byteArray); ByteArrayOutputStream baos = new ByteArrayOutputStream(); // apply extra content to the document using PdfStamper PdfStamper stamp = new PdfStamper(reader, baos); // lock down the document to only allow copying/printing stamp.setEncryption(PdfWriter.STRENGTH40BITS, null, null, PdfWriter.AllowCopy | PdfWriter.AllowPrinting); // AcroFields object that allows us to get PDF fields AcroFields acrobatForm = stamp.getAcroFields(); Set<String> names = acrobatForm.getFields().keySet(); // iterate over all the fillable form fields for( String name : names ) { // value for field, if any String value = valuesMap.get(name); if( value != null ) { acrobatForm.setField(name, value); } } // flatten all form fields upon closing stamp.setFormFlattening(true); stamp.close(); // set Content-disposition header String contentDisposition = "attachment; filename=T2202A-" + getPerson(request).getPersonId() + "-" + t2202AForm.getSelectedYear() + ".pdf"; response.setHeader("Content-disposition", contentDisposition); // set other headers response.setContentType("application/pdf"); response.setHeader("Expires", "0"); response.setHeader("Cache-Control", "max-age=600"); response.setHeader("Pragma", "public"); response.setContentLength(baos.size()); try { OutputStream out = response.getOutputStream(); baos.writeTo(out); out.flush(); out.close(); } catch( IOException ioe ) { logger.info("User hit cancel (or encountered an IO problem) while generating T2202A PDF. {}", ioe); } Thanks in advance, -- Haroon Rafique <[EMAIL PROTECTED]> ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Register now and save $200. Hurry, offer ends at 11:59 p.m., Monday, April 7! Use priority code J8TLD2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Do you like iText? Buy the iText book: http://www.1t3xt.com/docs/book.php Or leave a tip: https://tipit.to/itexttipjar