Why do I get the exception ‘PdfReader not opened with owner password’

When I tried to decrypt a owner password protected PDF(version 1.6) with the last version of itext yesterday, I got the exception, “PdfReader not opened with owner password”, then I tried to use my native version pdfdecrypt.exe(base on iText 1.46) and pdftk , it said the PDF version does not supports. so I had to google the result, then I got the answer,

Paulo Soares said,
From iText version 2.0.3 and iTextSharp 4.0.4 the password restrictions are enforced by the library instead of passing that responsability to the developer. Using PdfStamper or importing pages in PdfStamper, PdfCopy and PdfWriter will throw an exception if the PDF was not opened with the owner password.

then I tried iText 2.0.2, it works.

btw, I also find another solution from PDFSharp, and I notice a very interesting comment,

PDFsharp doesn’t try to protect the document because this make little sence for an open source library.

so why PdfReader try to protect the PDF?

Leave a Reply