DocEncrypt128

If you are a C/C++/C# developer and have any questions about using our products from your application here is the place to post them.
Post Reply
joh
Posts: 1
Joined: Thu Sep 02 2010

DocEncrypt128

Post by joh » Wed Sep 08 2010

I try to encrypt a pdf-file.
But I get the error: -1000.

Other Functions (i.e. DocSetTitleA) are working well.

What's the meaning of errorcode: -1000?

yours
Jo

Jose
Amyuni Team
Posts: 549
Joined: Tue Oct 01 2002
Contact:

Re: DocEncrypt128

Post by Jose » Thu Mar 22 2012

Hello,

Below is code snippet that may help you. It illustrates how to encrypt a PDF document.

EXTDOCHANDLE doc; // Handle to Document
HINSTANCE hDLL; // Handle to DLL
hDLL = LoadLibrary( _T("CDINTF450.DLL") );

if ( hDLL != NULL )
{

//Must check return codes of all functions
DocOpenA = (lpfnDocOpenAProc) GetProcAddress (hDLL, _T("DocOpenA"));
DocEncrypt128A = (lpfnDocEncrypt128AProc) GetProcAddress (hDLL, _T("DocEncrypt128A"));
DocSaveA = (lpfnDocSaveAProc) GetProcAddress (hDLL, _T("DocSaveA"));
DocClose = (lpfnDocCloseProc) GetProcAddress (hDLL, _T("DocClose"));
SetLicenseKeyA = (lpfnSetLicenseKeyAProc) GetProcAddress (hDLL, _T("SetLicenseKeyA"));

(*SetLicenseKeyA) ("Amyuni Tech Eval", "07EFCDAB01000100FB0841E7D8A5FDC96C023E0C9C3E537935719C2E3A4F4653C93F512EA54A1F3BDE4FE74002EC99BC499975DD2A92");
(*DocOpenA)(&doc, "c:\\temp\\images.pdf", "");

(*DocEncrypt128A) ( doc, "aaaaaa","bbbbbb", -64);

(*DocSaveA)(doc, _T("c:\\temp\\images_Encrypt.pdf"));
(*DocClose)(doc);

FreeLibrary(hDLL);
}
else
{
CString str = "something went wrong";
}

Thanks
Get PDF Suite, the expert .NET developer toolkit for PDF conversion, creation and editing - www.amyuni.com/pdfsuite

Post Reply