GetStringListItemA

Miscellaneous functions

Description

A-ul final denumește punctul de intrare DLL ANSI (char); suprafața ActiveX/COM expune doar forma Unicode. Comportamentul este identic cu GetStringListItem, iar argumentele de tip șir sunt interpretate folosind pagina de cod SetAnsiMode curentă

Returns the string at position ItemIndex in the string list identified by StringListID. String lists are produced by other API functions — most commonly CheckFileCompliance, which returns one entry per detected compliance issue.

Syntax

Delphi

Function DLGetStringListItemA(InstanceID, StringListID, ItemIndex: Integer): PAnsiChar;

DLL

const char * DLGetStringListItemA(int InstanceID, int StringListID, int ItemIndex);

Parameters

StringListIDThe ID of the string list as returned by a producer function such as CheckFileCompliance.
ItemIndexThe one-based index of the item to retrieve. The first item is 1; the last item is GetStringListCount(StringListID). Out-of-range indices return an empty string.

Return value

The string at the requested index, or an empty string if StringListID is invalid or ItemIndex is outside [1 .. GetStringListCount].

Remarks

For lists produced by CheckFileCompliance the item format is CODE: human-readable description, where CODE is one of the five-digit issue codes documented on the CheckFileCompliance page (00002, 00003, 00005, 00006, 00007, 00011, 00012). Strip the prefix before the colon to act on the code programmatically.

Example

// Parse the issue code from each compliance issue line
var
  Issues, Count, I, ColonPos: Integer;
  Line, Code: WideString;
begin
  Issues := PDF.CheckFileCompliance('archive.pdf', '', 1, 0);
  if Issues = 0 then Exit;

  Count := PDF.GetStringListCount(Issues);
  for I := 1 to Count do
  begin
    Line := PDF.GetStringListItem(Issues, I);
    ColonPos := Pos(':', Line);
    if ColonPos > 0 then
      Code := Trim(Copy(Line, 1, ColonPos - 1))
    else
      Code := Line;

    if Code = '00006' then
      WriteLn('Document is encrypted — cannot be PDF/A')
    else
      WriteLn('Issue ', Code, ': ', Line);
  end;
  PDF.ReleaseStringList(Issues);
end;

See also

GetStringListCount, ReleaseStringList, CheckFileCompliance