GetStringListItemA

Miscellaneous functions

Description

끝의 A는 ANSI(char) DLL 진입점을 나타내며, ActiveX/COM 표면에서는 Unicode 형식만 노출된다. 동작은 GetStringListItem와 동일하며, 문자열 인수는 현재 SetAnsiMode 코드 페이지를 사용해 해석된다

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