The PdfEncryptor.encrypt() method uses PdfStamper internally, and PdfStamper 
tampers the PdfReader instance, so that it cannot be used by other objects , 
neither other PdfStampers.

If you only need to encrypt a document, I believe the PdfEncryptor class will 
suffice.
Or you could only use the PdfStamper.setEncryption() method instead.

Fabrizio





________________________________
Da: Dave Jarvis <[email protected]>
A: [email protected]
Inviato: Gio 19 novembre 2009, 11:42:33
Oggetto: [iText-questions] Question on using PdfEncryptor and PdfStamper 
together.

 
Hi, the below gives the “The
original document was reused. Read it again from file” error because i am using
both PdfEncryptor and PdfStamper together (each on its own works fine). How
should i do it please ? Do i need to write to a temp file. How please ?
 
 
byte[] bb = ....
 
PdfReader reader = new
PdfReader(bb);
 
PdfEncryptor.encrypt(reader, os,
null, null, PdfWriter.AllowPrinting |PdfWriter.AllowCopy
|PdfWriter.AllowScreenReaders, false);
                 
PdfStamper stamp = new
PdfStamper(reader, os);
 
Thanks
Dave


      
------------------------------------------------------------------------------
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