GetNumberOfPagesInImageFile throws exception when High (128-bit AES) encryption level pdf file

  • 181 Views
  • Last Post 2 weeks ago
Rasheed Shaik posted this 2 weeks ago

Hi , I am facing one exception which I don't understand kindly can you help me.   Problem statement:  I am giving a high (128-bit AES) encryption level pdf as a input to   AbbyyEngine->GetNumberOfPagesInImageFile(filename, 0) API and its throwing the exception. Kindly can you help, Its not showing any exception information, mostly it would be internal error/exception. how to get the number of pages in high encryption pdf file.
If its a normal pdf, I am able to get the number of pages but not working for high 128-bit AES encryption pdf file. Kindly can you help me.     int ReadImageHeaderInfo(LPTSTR FileName, int *Number, BOOL *Supported) {    *Supported= FALSE;    *Number= -1;    try    {            *Number= cpAbbyyEngine->GetNumberOfPagesInImageFile(FileName, 0);    }    catch (...)    {       return -1; // something wrong with the file!    }    if (*Number <= 0)       return -1;    *Supported= TRUE;    return 0; }         Thanks,

IvanPopov posted this 2 weeks ago

As mentioned in the description of the IEngine::GetNumberOfPagesInImageFile() method in the Developer's Help article API Reference → Engine Object (IEngine Interface) → Processing Methods, the PasswordCallback parameter should not be 0 if you are trying to open a password-protected PDF file. From what I understand, you are trying to open such a file.

Therefore, you should implement the IImagePasswordCallback interface and pass an object derived from this interface to the  IEngine::GetNumberOfPagesInImageFile() method. Please find more information in the Developer's Help file articles API Reference → Engine Object (IEngine Interface)→ Processing Methods and API Reference → Image-Related Objects → IImagePasswordCallback.

Close