pdfGetInEncryptionFlags
Two genuine In-prefixed import-source inspectors,
int32_t __stdcall pdfGetInIsEncrypted(PPDF IPDF);
int32_t __stdcall pdfGetInEncryptionFlags(PPDF IPDF);
function pdfGetInIsEncrypted(const IPDF: PPDF): Integer; stdcall;
function pdfGetInEncryptionFlags(const IPDF: PPDF): Integer; stdcall;
Purpose. Two genuine In-prefixed import-source inspectors, reporting whether the currently open import file (pdfOpenImportFile*) is encrypted, and its permission-flags bitmask.
Description. Inconsistent NO_IMPORT_ERR sentinel convention, confirmed again in this volume (the same inconsistency previously documented for the broader pdfGetIn* family, Document Info, Metadata, and Versioning): pdfGetInEncryptionFlags guards with HasImportFile and returns the dedicated NO_IMPORT_ERR sentinel (-1073742011) if no import file is open, but pdfGetInIsEncrypted has no such guard at all — it calls D.ImportIsEncrypted unconditionally, which itself simply checks FImportSrc <> nil internally and returns 0 either way (no import open, or import open but not encrypted) — so pdfGetInIsEncrypted never returns NO_IMPORT_ERR, unlike its sibling in the same cluster. ImportIsEncrypted itself checks the import source's trailer for an /Encrypt key's mere presence (not whether decryption actually succeeds); ImportEncFlags reads the permission bits out of that /Encrypt dictionary.
Parameters.
| Parameter | Description |
|---|---|
IPDF | Document handle (whose *import source* is inspected). |
Return value. pdfGetInIsEncrypted: 1 if the import source's trailer has an /Encrypt entry; 0 otherwise (including when no import file is open — never NO_IMPORT_ERR). pdfGetInEncryptionFlags: the permission bitmask; NO_IMPORT_ERR if no import file is open.
C# (P/Invoke)
public static extern int pdfGetInEncryptionFlags(IntPtr IPDF);
Getters
pdfGetInEncryptionFlags
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.