API referenceImport & Output APIs

pdfSetEmbeddedFileStrProperty

Change a string property of an existing attachment.

Exported namespdfSetEmbeddedFileStrProperty (bare = ANSI), pdfSetEmbeddedFileStrPropertyA, pdfSetEmbeddedFileStrPropertyW

Purpose — Change a string property of an existing attachment.

DescriptionIndex is the 1-based attachment handle. Tag selects the property:

TagProperty written at serialization
0/Desc (description)
1/AFRelationship (name — e.g. Data, Source, Alternative; setting it makes the file an associated file)
2/F and /UF (file name)

Any other tag fails. The W variant is narrowed to 8-bit storage.

C
int32_t __stdcall pdfSetEmbeddedFileStrPropertyA(PPDF IPDF, int32_t Index, int32_t Tag, const char*    NewValue);
int32_t __stdcall pdfSetEmbeddedFileStrPropertyW(PPDF IPDF, int32_t Index, int32_t Tag, const wchar_t* NewValue);

Return value1 on success, 0 on failure (invalid instance handle, index out of range, unknown tag). Integer, not BOOL32.

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
public static extern int pdfSetEmbeddedFileStrPropertyW(IntPtr IPDF, int Index, int Tag, IntPtr NewValue);
public static extern int pdfSetEmbeddedFileStrProperty(IntPtr IPDF, int Index, int Tag, IntPtr NewValue);
public static extern int pdfSetEmbeddedFileStrPropertyA(IntPtr IPDF, int Index, int Tag, IntPtr NewValue);
Area
Import & Output APIs
Category

Setters

Exported names

pdfSetEmbeddedFileStrPropertyW pdfSetEmbeddedFileStrProperty pdfSetEmbeddedFileStrPropertyA

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.