API reference › Import & Output APIs
pdfFindEmbeddedFile
Look up an attachment by its exact stored file name.
| Exported names | pdfFindEmbeddedFileA (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).
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)
public static extern int pdfFindEmbeddedFileW(IntPtr IPDF, [MarshalAs(UnmanagedType.LPWStr)] string Name);
public static extern int pdfFindEmbeddedFileA(IntPtr IPDF, [MarshalAs(UnmanagedType.LPStr)] string Name);
Core
pdfFindEmbeddedFileW
pdfFindEmbeddedFileA
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.