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

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