Share via


Handling PDF Errors

The LoadPDF and GetPDFData methods provide additional error information. The LoadPDF method can generate both warnings and errors while GetPDFData only generates warnings.

Note  You cannot use HRESULT to determine whether a warning occurred. Instead, you must check ReturnValue to determine whether the method was successful or returned a warning. (The ReturnValue property is returned as an out parameter of ExecMethod.)

You can use the macros and #defines contained in Ssperrcode.h to help you evaluate the errors and warnings returned by the methods. For more information on how to get the error object, see SMS Error Handling.

Errors prevent the PDF from importing data. After you determine that the SMS Provider returned the error object, check the lowest 8 bits of the ErrorCode property to see if they are set to 4 (R_PDFERROR). If the reason indicates a PDF error, the CauseInfo property contains a numeric value defined as one of the following:

// PDF syntax errors
#define PDF_ERROR_NOTPDF               3
#define PDF_ERROR_VERSION              4
#define PDF_ERROR_MISSINGNAME          9
#define PDF_ERROR_MISSINGLANG          11
#define PDF_ERROR_MISSINGPUB           12
#define PDF_ERROR_NOPROGS              13
#define PDF_ERROR_MISSINGPROGINFO      14
#define PDF_ERROR_PROGMISSINGNAME      16
#define PDF_ERROR_PROGMISSINGCMDLN     17
#define PDF_ERROR_BADTYPE              18

// other errors
#define PDF_ERROR FILEIO               7
#define PDF_ERROR_ICON_FILEIO          8
#define PDF_ERROR_DATABASE             19
#define PDF_ERROR_DUPPROGRAM           20

Warnings do not prevent the PDF from importing. Warnings are reported through the method's return value and are represented as a set of bit flags. One or more flags may be set. You are not told which program generated the warning. Use the following macro and #defines to determine which warnings occurred:

#define BIT(N)                   (1UL<<(N))
#define PDF_WARN_RUN             BIT(0)
#define PDF_WARN_RESTART         BIT(1)
#define PDF_WARN_CANRUNWHEN      BIT(2)
#define PDF_WARN_ASSIGNMENT      BIT(3)
#define PDF_WARN_BADDEPNDPROG    BIT(4)
#define PDF_WARN_BADDL           BIT(5)
#define PDF_WARN_BADDISKSPREQ    BIT(6)
#define PDF_WARN_NOSUPCLINFO     BIT(7)
#define PDF_WARN_BADSUPCLINFO    BIT(8)
#define PDF_WARN_VER1PDF         BIT(9)
#define PDF_WARN_REMPROGNOKEY    BIT(10)

For complete details of the PDF format and content, see the online SMS Administrator's Guide. This information may help you resolve any of the warning conditions.