API referenceImport & Output APIs

pdfStoreCustomDataFromFile

Store a file's raw bytes as a private blob under

Exported namespdfStoreCustomDataFromFile (bare = ANSI), …A, …W; companion pdfStoreCustomDataFromString

Purpose — Store a file's raw bytes as a private blob under (Location, Key).

Description — The blob lives in an instance-side dictionary keyed by Location and Key (the same key under different locations is two independent blobs; storing an existing pair overwrites). Blobs serialize into a private /LumasCustomData dictionary on the catalog. Options is accepted for ABI compatibility and ignored.

C
int32_t __stdcall pdfStoreCustomDataFromFileA(PPDF IPDF, const char*    Key, const char*    FileName, int32_t Location, int32_t Options);
int32_t __stdcall pdfStoreCustomDataFromFileW(PPDF IPDF, const wchar_t* Key, const wchar_t* FileName, int32_t Location, int32_t Options);

Return value1 on success; 0 for an empty key, missing/unreadable file, or invalid instance handle.

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
public static extern int pdfStoreCustomDataFromFileW(IntPtr IPDF, IntPtr Key, IntPtr FileName, int Location, int Options);
public static extern int pdfStoreCustomDataFromFile(IntPtr IPDF, IntPtr Key, IntPtr FileName, int Location, int Options);
public static extern int pdfStoreCustomDataFromFileA(IntPtr IPDF, IntPtr Key, IntPtr FileName, int Location, int Options);
Area
Import & Output APIs
Category

Core

Exported names

pdfStoreCustomDataFromFileW pdfStoreCustomDataFromFile pdfStoreCustomDataFromFileA

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.