[email protected] wrote:
>> Why do you think adding annotations isn't allowed?
>> Do you get an exception?
> 
> Yes.
> 
>> Or is something else going wrong?
> 
> No.
> 
> The document restrictions summary in Adobe Reader says:
> 
> Commenting: Not allowed

OK,
then you have everything you need in chapter 3 of the book.
You can also try this example: http://1t3xt.be/?X1ce

The example examines 4 PDF files.
This is the output:

=== Encryption info for 
results/in_action/chapter03/HelloWorldNotEncrypted.pdf ===
Encrypted? false
=== Encryption info for 
results/in_action/chapter03/HelloWorldEncrypted1.pdf ===
Encrypted? true
Permissions: Allowed: Printing Copy Fill in Screen readers Assembly 
Degraded printing
128 bit? false
=== Encryption info for 
results/in_action/chapter03/HelloWorldEncrypted2.pdf ===
Encrypted? true
Permissions: Allowed: Degraded printing
128 bit? true
=== Encryption info for 
results/in_action/chapter03/HelloWorldDecrypted.pdf ===
Encrypted? false

You could use reader.isEncrypted() and reader.getPermissions()
to check if commenting is allowed (as you can see getPermissions
doesn't always return 0, at least not when I run this example),
but I don't see how this will help you.

Even if commenting is allowed, iText won't allow you to do so
because the way iText deals with encryption isn't really fine-grained.
Adding more fine-grained control was on our TODO list briefly,
but the company interested in this functionality didn't want
to sponsor in the development, and other priorities got in
the way, so it's now at the very bottom of our TODO list.
-- 
This answer is provided by 1T3XT BVBA
http://www.1t3xt.com/ - http://www.1t3xt.info

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
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/

Reply via email to