API reference › Import & Output APIs
pdfClearFileList
Empty a named string list previously filled with
| Exported names | pdfClearFileList (bare = ANSI), pdfClearFileListA, pdfClearFileListW |
|---|
Purpose — Empty a named string list previously filled with pdfAddToFileList.
Description — These lists are a general-purpose instance-side name→list store (used e.g. to stage file names for batch operations); they are not the attachment table — clearing a list does not delete embedded files. The list keeps its identity (a later pdfAddToFileList with the same name reuses it).
int32_t __stdcall pdfClearFileListA(PPDF IPDF, const char* ListName);
int32_t __stdcall pdfClearFileListW(PPDF IPDF, const wchar_t* ListName);
Return value — Number of entries removed; 0 if the list does not exist, ListName is empty, or the instance handle is invalid.
Example — attach generated XML and read it back (Delphi)
var
Pdf: PPDF; H: Integer; Xml: UTF8String; FS: TPDFFileSpec;
begin
Pdf := pdfNewPDF;
try
if not pdfCreateNewPDFW(Pdf, 'invoice.pdf') then Abort;
pdfAppend(Pdf);
// ... page content ...
pdfEndPage(Pdf);
Xml := '<invoice>...</invoice>';
H := pdfAttachFileExW(Pdf, PAnsiChar(Xml), Length(Xml),
'factur-x.xml', 'Invoice data', True);
if H <= 0 then Abort;
// mark it as the machine-readable representation (associated file)
if pdfSetEmbeddedFileStrPropertyW(Pdf, H, 1, 'Data') = 0 then Abort;
// read-back check
if not pdfGetEmbeddedFile(Pdf, Cardinal(H), FS, True) then Abort;
Assert(FS.BufSize = Cardinal(Length(Xml)));
if not pdfCloseFile(Pdf) then Abort;
finally
pdfDeletePDF(Pdf);
end;
end;
See also — pdfCloseFile · collection/portfolio APIs (Volume 3) · PDF/A associated-file rules (Volume 12)
C# (P/Invoke)
public static extern int pdfClearFileListW(IntPtr IPDF, IntPtr ListName);
public static extern int pdfClearFileList(IntPtr IPDF, IntPtr ListName);
public static extern int pdfClearFileListA(IntPtr IPDF, IntPtr ListName);
Core
pdfClearFileListW
pdfClearFileList
pdfClearFileListA
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.