error = pdf.GetLastError()
pdf.GetLastError()
can be used to get additional
information why the document couldn't be opened. This is especially useful to find out if
the document couldn't be opened because it is password-protected.
pdf.GetLastError()
will return one of the following error codes:
#PDFERR_SUCCESS:
#PDFERR_UNKNOWN:
#PDFERR_FILE:
#PDFERR_FORMAT:
#PDFERR_PASSWORD:
#PDFERR_SECURITY:
#PDFERR_PAGE:
Note that you have to call pdf.GetLastError()
immediately after pdf.OpenDocument()
to get the correct result code.