GetStringListCount

Miscellaneous functions

Description

Returns the number of strings stored in a string list created by another API function. The most common producer is CheckFileCompliance, which returns a non-zero StringListID whose entries list the compliance issues found in the validated document.

Syntax

Delphi

function TPDFlib.GetStringListCount(StringListID: Integer): Integer;

ActiveX

Function PDFlib::GetStringListCount(StringListID As Long) As Long

DLL

int DLGetStringListCount(int InstanceID, int StringListID);

Parameters

StringListIDThe ID of the string list as returned by a producer function such as CheckFileCompliance. Must reference a string list owned by the current PDFlib instance.

Return values

0The list is empty, or StringListID does not reference a valid string list owned by this instance.
> 0The number of strings currently in the list.

Remarks

The returned count is the upper bound for the ItemIndex argument of GetStringListItem: valid indices are 1 through GetStringListCount(StringListID), inclusive. Items are not numbered from zero.

String lists are owned by the PDFlib instance that produced them and are freed automatically when the instance is destroyed. Call ReleaseStringList if you want to release a list earlier than that — for example, in a long-running process that validates many files in sequence.

Example

// Enumerate every compliance issue reported by CheckFileCompliance
var
  Issues, Count, I: Integer;
begin
  Issues := PDF.CheckFileCompliance('output.pdf', '', 1, 0);
  if Issues <> 0 then
  begin
    Count := PDF.GetStringListCount(Issues);
    for I := 1 to Count do
      WriteLn(PDF.GetStringListItem(Issues, I));
    PDF.ReleaseStringList(Issues);
  end;
end;

See also

GetStringListItem, ReleaseStringList, CheckFileCompliance