Hi i have bought the book and tried out the example but i am having a problem
filling out an acroform.

below is my code, which is almost directly taken from the example listing in
8.2.9

i am calling it with
fillForm(RESOURCE, RESULT1, false, false);
fillForm(RESOURCE, RESULT2, true, false);
fillForm(RESOURCE, RESULT3, false, true);

they all given error on the *new PdfStamper * line saying

java.lang.IllegalArgumentException: PdfReader not opened with owner password

I am using iText version 2.0.8.  (due to us also using Flying Saucer). 

public void fillForm(InputStream in, OutputStream out, boolean remove,
boolean preserve) { 

        PdfReader reader = new PdfReader(in);
        if (remove)
            reader.removeUsageRights();
                
        PdfStamper stamper;   
        if (preserve) {
                stamper = new PdfStamper(reader, out, '\0', true);
            } else {
                stamper = new PdfStamper(reader, out);
            }
            
                
                
            AcroFields form = stamper.getAcroFields();
                        Map<String, Item> fields = form.getFields();
                
            Iterator<Entry&lt;String, Item>> entries =
fields.entrySet().iterator();

            while  (entries.hasNext()) {
                Entry thisEntry = (Entry) entries.next();
                String key = (String) thisEntry.getKey();       // key on the
acroform
                // do some lookup 
                form.setField(key, value);
                
            }
                

what am i missing? any help would be greatly appreciated.

--
View this message in context: 
http://itext-general.2136553.n4.nabble.com/PdfReader-not-opened-with-owner-password-Reader-enabling-a-form-tp4113891p4113891.html
Sent from the iText - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to