That's quite easy:

PdfReader reader = new PdfReader("f1023.pdf");
PdfDictionary catalog = reader.getCatalog();
PdfDictionary viewerPreferences =
(PdfDictionary)PdfReader.getPdfObject(catalog.get(PdfName.VIEWERPREFERENCES)
);
if (viewerPreferences != null) {
    viewerPreferences.remove(new PdfName("Rights"));
}

----- Original Message ----- 
From: "John Wilson" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, February 09, 2005 4:06 PM
Subject: [iText-questions] Removing rights from a PDF document


> Hi!
>
> I am experimenting with using iText to automatically fill in a PDF form
> and then flatten it. It appears to be very easy to do this;)
>
> The form I am experimenting with (US IRS tax form 1023) has extra
> rights applied to it. These are Save Document and Advanced Form
> Features (or, at last this is what Acrobat Reader tells me). I set the
> form fields and flatten the document. When I use Acrobat Reader to view
> the new version I get a dialog box warning me that The document
> contained rights but that it has been changed since it was created and
> these rights are no longer valid. When I dismiss the dialog box the
> viewer renders the document just fine.
>
> I'd like to remove the rights from the document when I'm filling the
> form in so that my users don't get the dialog box. However I can't seem
> to find anything in the iText API which would let me do this. Is it
> possible to do this? If so could you please show me how?
>
> Thanks
>
> John Wilson
> The Wilson Partnership
> http://www.wilson.co.uk
>
>
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to