tags:

views:

17

answers:

0

I am using the following code:

using (Stream input = new FileStream("C:\\Users\\admin\\Desktop\\SQLServer2008KeyBoardShortcuts.pdf", FileMode.Open, FileAccess.Read, FileShare.Read))
using (Stream output = new FileStream("C:\\Users\\admin\\Desktop\\SQLServer2008KeyBoardShortcuts0.pdf", FileMode.Create, FileAccess.Write, FileShare.None))
{
    PdfReader reader = new PdfReader(input);
    PdfEncryptor.Encrypt(reader, output, true, "uesr", "owner", PdfWriter.ALLOW_DEGRADED_PRINTING);
}

But I am getting an error

PdfReader not opened with owner password