API referenceImport & Output APIs

pdfFindEmbeddedFile

Look up an attachment by its exact stored file name.

Exported namespdfFindEmbeddedFileA (UTF-8), pdfFindEmbeddedFileW

Purpose — Look up an attachment by its exact stored file name.

Description — Linear search over the attachment table comparing the stored name byte-for-byte (case-sensitive; the W variant is narrowed to 8-bit before comparison).

C
int32_t __stdcall pdfFindEmbeddedFileA(PPDF IPDF, const char*    Name);
int32_t __stdcall pdfFindEmbeddedFileW(PPDF IPDF, const wchar_t* Name);

Return value — ⚠ the 0-based index of the match, or -1 if not found / invalid handle. Unlike every other embedded-file call, this is *not* the 1-based handle — add 1 before passing the result to pdfGetEmbeddedFile, pdfSetEmbeddedFileStrProperty, or pdfDeleteEmbeddedFile.

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
public static extern int pdfFindEmbeddedFileW(IntPtr IPDF, [MarshalAs(UnmanagedType.LPWStr)] string Name);
public static extern int pdfFindEmbeddedFileA(IntPtr IPDF, [MarshalAs(UnmanagedType.LPStr)] string Name);
Area
Import & Output APIs
Category

Core

Exported names

pdfFindEmbeddedFileW pdfFindEmbeddedFileA

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.