GetStringListItem

Miscellaneous functions

Description

Retourneert de tekenreeks op positie ItemIndex in de stringlijst geïdentificeerd door StringListID; stringlijsten worden geproduceerd door andere API-functies — meestal CheckFileCompliance, die één item retourneert per gedetecteerd nalevingsprobleem

Syntax

Delphi

Function TPDFlib.GetStringListItem(StringListID, ItemIndex: Integer): WideString;

ActiveX

Function PDFlib::GetStringListItem(StringListID As Long, ItemIndex As Long) As String

DLL

const wchar_t * DLGetStringListItem(int InstanceID, int StringListID, int ItemIndex);

Parameters

StringListIDHet ID van de stringlijst zoals geretourneerd door een producer-functie zoals CheckFileCompliance
ItemIndexDe op één gebaseerde index van het op te halen item. Het eerste item is 1; het laatste item is GetStringListCount(StringListID). Indexen buiten het bereik retourneren een lege string

Return value

De tekenreeks op de gevraagde index, of een lege tekenreeks als StringListID ongeldig is of ItemIndex buiten [1 .. GetStringListCount] valt

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