[Solved] Decrypting PDF throws an exception error in Creator

The PDF Creator enables you to create secure PDF documents and to view, print and process existing PDF documents.
If you have any questions about the installation and usage of the PDF Creator please post them here.
Post Reply
wd818
Posts: 22
Joined: Tue Oct 14 2008

[Solved] Decrypting PDF throws an exception error in Creator

Post by wd818 »

Hello

I get an exception error when decrypting a password protected PDF file using PDF Creator 3.03. It is thrown by the function Encrypt()

The error message is

System.Runtime.InteropServices.SEHEException: External component has thrown an exception.
At CWnd.InvokeHelper(CWnd*, Int32, UInt16, UInt16, Void*, Byte *)
At CPdfcreactivex.Encrypt()

Here is what I do to decrypt the PDF file and save it

m_pdf is an ActiveX in my MFC application

m_pdf.Open(strURL, “123”); //Open password protected PDF with its password 123

try
{
m_pdf.Encrypt("", "", 0); //decrypt file
}
catch (System::Exception ^ e)
{
::AfxMessageBox(CString(e->ToString())); //display exception message
}

m_pdf.Save(newLocation, 1); //save to newLocation

Can someone help me?

Thanks
David
Amyuni Team
Posts: 89
Joined: Mon Dec 18 2006

Re: Decrypting PDF throws an exception error in Creator 3.03

Post by David »

Hello

Your code for decrypting the file is correct.

You need to check that you are using the Owner Password to open the file.
If you open the document using the User Password and the option "Changing the document" is not enabled, you will encounter the problem you mentioned.

Hope that helps?

David
Amyuni Custom Development
Do you need a specific PDF solution? Are you looking for expertise that will enable you to start or complete a PDF integration project?
http://www.amyuni.com/en/company/services.php
wd818
Posts: 22
Joined: Tue Oct 14 2008

Re: Decrypting PDF throws an exception error in Creator 3.03

Post by wd818 »

After doing the following, I still get the same exception error with a USER's password

m_pdf.Open(strURL, “123”); //Open password protected PDF with its USER's password 123

try
{
m_pdf.Encrypt("", "", 0xFFFFFFC0 + 8 ); //decrypt file, "Changing the document" is enabled?
}
catch (System::Exception ^ e)
{
::AfxMessageBox(CString(e->ToString())); //display exception message
}

m_pdf.Save(newLocation, 1); //save to newLocation

I have tried with an owner's password, it decrypts with no problem.
How to correctly enable the option "Changing the document" when the only password available is a USER's password?
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Re: Decrypting PDF throws an exception error in Creator 3.03

Post by Joan »

A User's password doesn't decrypt the PDF file. This is unethical :-) Only owners have the right to decrypt a document
Custom Brand the Amyuni PDF Printer Driver http://www.amyuni.com/en/developer/branding/index.html

Amyuni PDF Converter tested for true PDF performance. View results - http://www.amyuni.com/benchmark
wd818
Posts: 22
Joined: Tue Oct 14 2008

Re: Decrypting PDF throws an exception error in Creator 3.03

Post by wd818 »

I see, thank you for your help.
Post Reply