API referenceEncryption

pdfImportEncryptionSettings

Carry the currently-open import source's encryption

C
BOOL32 __stdcall pdfImportEncryptionSettings(PPDF IPDF);
Delphi
function pdfImportEncryptionSettings(const IPDF: PPDF): LongBool; stdcall;

Purpose. Carry the currently-open import source's encryption permission flags forward onto the live document being written — not a full settings clone.

Description. Success is defined as "the import file is open", independent of whether the import source is actually encrypted at all — calling this on an unencrypted import source still returns True (a real permission copy of 0/unrestricted, effectively a no-op in that case). The real work (ImportEncryptionSettings) exits early (Result := False, contradicting the wrapper's own "import open = success" framing at the Pascal-method level, though the wrapper itself doesn't propagate this inner False) if the source isn't encrypted; otherwise it copies the source's permission bits and calls SetEncryption(klAES128, '', '', Perms)always AES-128 with empty open/owner passwords, never the source's actual algorithm or passwords, because (per an inline comment) "passwords cannot be recovered from the source /Encrypt dict." A caller expecting a faithful clone of the source's encryption (same key length, same passwords) will not get one — only the permission restrictions transfer.

Parameters.

ParameterDescription
IPDFDocument handle.

Return value. True if an import file is open (regardless of whether it was actually encrypted or whether permissions were actually copied — the wrapper's success signal is looser than the underlying method's).

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
[return: MarshalAs(UnmanagedType.Bool)]
Area
Encryption
Category

Import

Exported names

pdfImportEncryptionSettings

String variants

The …A form takes UTF-8, …W takes UTF-16; a bare name aliases the ANSI form.

See working code

Worked examples — complete programs in ten languages.