LastErrorCode
Miscellaneous functions
Description
Use this function to determine the reason certain functions failed
Reading the value is destructive: the function returns the stored error code and resets it to zero, so a second call right after a failure returns 0. Capture the result into a local variable before branching on it
Syntax
Delphi
Function TPDFlib.LastErrorCode: Integer;
ActiveX
Function PDFlib::LastErrorCode() As Long
DLL
int DLLastErrorCode(int InstanceID);
Return values
| 0 | The last call completed successfully |
|---|---|
| 101 | The Strength parameter passed to the Encrypt function was invalid |
| 102 | The Permissions parameter passed to the Encrypt function was invalid. Use the EncodePermissions function to construct a value for this parameter |
| 103 | The Encrypt function was used on a document that was already encrypted |
| 104 | The Encrypt function failed for an unknown reason |
| 105 | Invalid PDF object JSON (PDFLIB_ERROR_OBJECT_JSON_INVALID) |
| 106 | Invalid QDF input (PDFLIB_ERROR_QDF_INVALID) |
| 107 | QDF stream lengths or object boundaries cannot be repaired (PDFLIB_ERROR_QDF_REPAIR) |
| 108 | The server holding a remote PDF ignored or did not support the HTTP byte-range requests the open mode requires (PDFLIB_ERROR_NET_RANGE_UNSUPPORTED) |
| 109 | An HTTP(S) request issued while opening or reading a remote PDF failed (PDFLIB_ERROR_NET_HTTP) |
| 110 | Invalid OCR result JSON (PDFLIB_ERROR_OCR_RESULT_INVALID) |
| 111 | Invalid structured text extraction request (PDFLIB_ERROR_STRUCTURED_TEXT_INVALID) |
| 112 | Invalid HTML layout export request (PDFLIB_ERROR_HTML_EXPORT_INVALID) |
| 113 | Invalid Markdown export request (PDFLIB_ERROR_MARKDOWN_EXPORT_INVALID) |
| 114 | Invalid DOCX export request (PDFLIB_ERROR_DOCX_EXPORT_INVALID) |
| 115 | Invalid barcode recognition request (PDFLIB_ERROR_BARCODE_RECOGNITION_INVALID) |
| 116 | Invalid page deskew request (PDFLIB_ERROR_DESKEW_INVALID) |
| 117 | Invalid API scope transition (PDFLIB_ERROR_API_SCOPE) |
| 119 | Invalid SVG page export request (PDFLIB_ERROR_SVG_EXPORT_INVALID) |
| 120 | Invalid print stream export request (PDFLIB_ERROR_PRINT_STREAM_INVALID) |
| 121 | Invalid HTML story layout request (PDFLIB_ERROR_HTML_STORY_INVALID) |
| 122 | Invalid document part hierarchy request (PDFLIB_ERROR_DPART_INVALID) |
| 124 | Invalid or malformed PostScript conversion input (PDFLIB_ERROR_POSTSCRIPT_INVALID) |
| 201 | The SetInformation function failed because the document is encrypted |
| 202 | The Key parameter passed to the SetInformation function was out of range |
| 125 | Invalid, non-finite, or out-of-range electronic invoice generation input (PDFLIB_ERROR_INVOICE_INVALID) |
| 301 | An invalid combination of barcode and option was sent to the DrawBarcode function |
| 302 | Non-numeric characters were sent to DrawBarcode using EAN-13 |
| 303 | The EAN-13 barcode has an invalid checksum character |
| 304 | Cannot write PDF object JSON (PDFLIB_ERROR_OBJECT_JSON_WRITE) |
| 305 | Cannot write QDF output (PDFLIB_ERROR_QDF_WRITE) |
| 306 | A remote or local input file could not be opened (PDFLIB_ERROR_NET_OPEN) |
| 307 | Cannot write OCR text layer (PDFLIB_ERROR_OCR_WRITE) |
| 401 | Could not open input file |
| 402 | Output file already exists and could not be deleted |
| 403 | Could not open output file |
| 404 | Invalid password |
| 405 | Document is not encrypted |
| 406 | Document is already encrypted |
| 407 | Invalid encryption strength |
| 408 | Invalid permissions |
| 409 | Invalid file structure, file is damaged, or authenticated decryption detected modified ciphertext |
| 410 | One of the input files is encrypted |
| 411 | File not found |
| 412 | Invalid page range list |
| 413 | A required PDF MAC token is missing (PDFLIB_ERROR_PDF_MAC_REQUIRED) |
| 414 | PDF MAC data is malformed (PDFLIB_ERROR_PDF_MAC_MALFORMED) |
| 415 | PDF MAC byte ranges do not cover the complete file (PDFLIB_ERROR_PDF_MAC_COVERAGE) |
| 416 | PDF MAC key unwrap or authentication failed (PDFLIB_ERROR_PDF_MAC_AUTHENTICATION) |
| 417 | The PDF MAC algorithm or location is unsupported (PDFLIB_ERROR_PDF_MAC_ALGORITHM) |
| 418 | PDF MAC configuration or generation is invalid (PDFLIB_ERROR_PDF_MAC_CONFIGURATION) |
| 419 | A public-key decryption credential is required (PDFLIB_ERROR_PUBSEC_CREDENTIAL_REQUIRED) |
| 420 | The public-key decryption credential is invalid (PDFLIB_ERROR_PUBSEC_CREDENTIAL_INVALID) |
| 421 | No matching public-key recipient was found (PDFLIB_ERROR_PUBSEC_RECIPIENT_NOT_FOUND) |
| 422 | The CMS recipient envelope is malformed or ambiguous (PDFLIB_ERROR_PUBSEC_MALFORMED) |
| 423 | The public-key security handler or algorithm is unsupported (PDFLIB_ERROR_PUBSEC_UNSUPPORTED) |
| 424 | The public-key recipient or encryption configuration is invalid (PDFLIB_ERROR_PUBSEC_RECIPIENT_INVALID) |
| 425 | The raw encryption key passed to the low-level encryption entry is not a valid size for the selected algorithm (PDFLIB_ERROR_RAW_ENCRYPTION_KEY_INVALID) |
| 501 | The specified FileHandle was invalid |
| 506 | A text font has no usable vector outline source (PDFLIB_ERROR_TEXT_PATH_UNSUPPORTED_FONT) |
| 507 | Text clipping mode cannot be converted to paths safely (PDFLIB_ERROR_TEXT_PATH_CLIPPING) |
| 508 | Malformed content prevents text-to-path conversion (PDFLIB_ERROR_TEXT_PATH_MALFORMED) |
| 509 | Edit journal state is invalid (PDFLIB_ERROR_EDIT_JOURNAL_STATE) |
| 510 | Edit journal file is unavailable or corrupt (PDFLIB_ERROR_EDIT_JOURNAL_IO) |
| 511 | Edit transaction state is invalid (PDFLIB_ERROR_EDIT_JOURNAL_TRANSACTION) |
| 512 | Edit journal snapshot cannot be restored (PDFLIB_ERROR_EDIT_JOURNAL_RESTORE) |
| 513 | Edit journal belongs to another document (PDFLIB_ERROR_EDIT_JOURNAL_DOCUMENT) |
| 514 | OCR provider is unavailable or failed (PDFLIB_ERROR_OCR_PROVIDER) |
| 515 | Structured text extraction failed (PDFLIB_ERROR_STRUCTURED_TEXT) |
| 516 | HTML layout export failed (PDFLIB_ERROR_HTML_EXPORT) |
| 517 | Markdown export failed (PDFLIB_ERROR_MARKDOWN_EXPORT) |
| 518 | DOCX export failed (PDFLIB_ERROR_DOCX_EXPORT) |
| 519 | Barcode recognition failed (PDFLIB_ERROR_BARCODE_RECOGNITION) |
| 520 | Page deskew failed (PDFLIB_ERROR_DESKEW) |
| 521 | Text contains a glyph that the selected font cannot display (PDFLIB_ERROR_MISSING_GLYPH) |
| 522 | SVG page export failed (PDFLIB_ERROR_SVG_EXPORT) |
| 523 | Print stream export failed (PDFLIB_ERROR_PRINT_STREAM) |
| 524 | HTML story layout failed (PDFLIB_ERROR_HTML_STORY) |
| 525 | Document part hierarchy validation failed (PDFLIB_ERROR_DPART) |
| 526 | Exporting the document as JSON failed (PDFLIB_ERROR_EXPORT_JSON) |
| 529 | A marked-content reference is malformed or does not match the page content (PDFLIB_ERROR_MARKED_CONTENT_INVALID) |
| 530 | A marked-content reference refers to content that has changed since it was acquired (PDFLIB_ERROR_MARKED_CONTENT_STALE) |
| 531 | A marked-content tag could not be resolved against the page content streams (PDFLIB_ERROR_MARKED_CONTENT_UNRESOLVED) |
| 532 | A clip-path handle is malformed or was not produced by this document (PDFLIB_ERROR_CLIP_PATH_INVALID) |
| 533 | A clip-path handle refers to content that has changed since it was acquired (PDFLIB_ERROR_CLIP_PATH_STALE) |
| 534 | The content a clip-path handle refers to is read-only and cannot be rewritten (PDFLIB_ERROR_CLIP_PATH_READ_ONLY) |
| 535 | A text location handle is invalid or was used after the document changed (PDFLIB_ERROR_TEXT_LOCATION_INVALID) |
| 536 | A text location refers to content that has changed since the location was acquired (PDFLIB_ERROR_TEXT_LOCATION_STALE) |
| 537 | The content a text location refers to is read-only and cannot be rewritten (PDFLIB_ERROR_TEXT_LOCATION_READ_ONLY) |
| 538 | Unsupported PostScript operator or definition (PDFLIB_ERROR_POSTSCRIPT_UNSUPPORTED) |
| 539 | PostScript conversion exceeded its execution or output budget (PDFLIB_ERROR_POSTSCRIPT_BUDGET) |
| 602 | The selected PDF save version is lower than a feature present in the document. Choose a newer PDF version or remove the incompatible feature before saving (PDFLIB_ERROR_VERSION_COMPLIANCE) |
| 603 | A link annotation could not be integrated into the tagged structure tree (PDFLIB_ERROR_TAGGED_LINK_STRUCTURE) |
| 604 | The AES-256 password was rejected by SASLprep (RFC 4013): it contains prohibited code points or violates the bidirectional rules (PDFLIB_ERROR_PASSWORD_SASLPREP) |
| 605 | PDF/A is active but no embeddable font could be resolved for the implicit-font path, so the built-in Standard 14 metrics were used to keep drawing text safe; the file needs an embedded font before it conforms (PDFLIB_ERROR_NO_EMBEDDABLE_FONT) |
| 607 | PDF/R raster document compliance validation failed (PDFLIB_ERROR_PDFR_COMPLIANCE) |
| 608 | The document does not satisfy PDF/VCR compliance validation (PDFLIB_ERROR_PDFVCR_COMPLIANCE) |
| 609 | The document does not satisfy PDF/E compliance validation (PDFLIB_ERROR_PDFE_COMPLIANCE) |
| 701 | Form field not found |
| 702 | Form field is read-only |
| 703 | Document has no AcroForm |
| 704 | Invalid form field value |
| 705 | The requested form field name duplicates an existing field (PDFLIB_ERROR_FORM_DUPLICATE_FIELD) |
| 706 | A form JavaScript action uses a construct the built-in form script engine does not support (PDFLIB_ERROR_FORM_SCRIPT_UNSUPPORTED) |
| 707 | A form calculation would create a dependency cycle between fields (PDFLIB_ERROR_FORM_CALCULATION_CYCLE) |
| 708 | A form script is malformed or failed to compile (PDFLIB_ERROR_FORM_SCRIPT_INVALID) |
| 709 | A form script exceeded its execution budget and was aborted (PDFLIB_ERROR_FORM_SCRIPT_BUDGET) |