tags:

views:

797

answers:

0

Hi,

I am using iTextSharp.dll in my windows application, with iTextSharp i am password protecting the PDF file, its working fine for files less than 20,000kb. But when i am trying to password protect large files is above 20,000kb its throughing an exception as "PdfReader not opened with owner password".

Code:

Stream input = new FileStream("C:\\Disco_Images\\Radiologies\\atharlarge.pdf", FileMode.Open);

Stream output = new FileStream("C:\\Disco_Images\\Radiologies\\atharlarge_enc.pdf", FileMode.Create);

PdfReader reader = new PdfReader(input);

PdfEncryptor.Encrypt(reader, output, true, "secret", "secret", PdfWriter.ALLOW_PRINTING);

Please help me from this.

Thanks in advance,

Athar