Password Security, unable to merge pdf documents

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF CoreSuite for .NET (v10)  /  Password Security, unable to merge pdf documents

DynamicPDF CoreSuite for .NET (v10) Forum

Hello,

I have a pdf document, that i am able to view the document in Adobe reader without entering any password. But has a security of: Password Security.
PDF merger is unable to merge that document.

Please advise
I keep getting :"Document can not be decrypted. Invalid owner password.". But there is no password for this document, as i am able to view the PDF contents without having to enter a password.
Posted by a ceTe Software moderator
Hi,

Encrypted PDFs can have an ower and user password. If the user password is blank (""), it is possible to open an encrypted PDF without specifying a password. If you want to edit or merge an encrypted PDF though, you will need to specify the owner password. In order to work with an encrypted PDF in our product, you need to specify the owner password.

Thanks,
ceTe Software Support Team
Thank you for the reply.

I have got the same feeling after doing some research, but business needed the proof that its not a bug in the DynamicPDF library and an issue that can't be resolved with any other PDF library unless owner password is removed.
So Business is asking if there is a way to check if the pdf is encrypted with any kind of password and not merge them.

I will work on the merge part, but how to check if the pdf is encrypted or not?

What is the approach here?
Posted by a ceTe Software moderator
Hi,

You can check this by catching a PdfSecurityException as follows:

            PdfDocument pdfDocument = null;
            try
            {
                pdfDocument = new PdfDocument(@"source.pdf");
            }
            catch (PdfSecurityException ex)
            {
                pdfDocument = null;
                // Handle security exception
            }
            MergeDocument document = new MergeDocument(pdfDocument);

Thanks,
ceTe Software Support Team
Thank you for the quick reply!

Thank you for providing this quick way to check. Its neat.

All times are US Eastern Standard time. The time now is 7:34 AM.