GetStringListItem

פונקציות שונות

תיאור

מחזיר את המחרוזת במיקום ItemIndex ברשימת המחרוזות המזוהה באמצעות StringListID. רשימות מחרוזות נוצרות על ידי פונקציות API אחרות — בדרך כלל CheckFileCompliance, שמחזירה רשומה אחת עבור כל בעיית תאימות שזוהתה.

תחביר

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);

פרמטרים

StringListIDהמזהה של רשימת המחרוזות כפי שהוחזר מפונקציית יצרן כמו CheckFileCompliance
ItemIndexהאינדקס החל מ-1 של הפריט לשליפה. הפריט הראשון הוא 1; הפריט האחרון הוא GetStringListCount(StringListID). אינדקסים מחוץ לטווח מחזירים מחרוזת ריקה

ערך מוחזר

המחרוזת באינדקס המבוקש, או מחרוזת ריקה אם StringListID אינו תקין או ש-ItemIndex מחוץ ל-[1 .. GetStringListCount]

הערות

עבור רשימות שמופקות באמצעות CheckFileCompliance, פורמט הפריט הוא CODE: human-readable description, כאשר CODE הוא אחד מקודי הבעיות בעלי חמש ספרות המתועדים בדף CheckFileCompliance (00002, 00003, 00005, 00006, 00007, 00011, 00012). הסירו את הקידומת שלפני הנקודתיים כדי לפעול על הקוד באופן תכנותי

דוגמה

// 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;

ראו גם

GetStringListCount, ReleaseStringList, CheckFileCompliance