GetStringListItem
Různé funkce
Popis
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.
Syntaxe
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);
Parametry
| StringListID | ID seznamu řetězců, jak ho vrací produkční funkce jako CheckFileCompliance |
|---|---|
| ItemIndex | Index položky počítaný od 1. První položka je 1; poslední položka je GetStringListCount(StringListID). Indexy mimo rozsah vrací prázdný řetězec |
Návratová hodnota
Řetězec na požadovaném indexu, nebo prázdný řetězec, je-li StringListID neplatné nebo ItemIndex mimo [1 .. GetStringListCount]
Poznámky
U seznamů vytvořených funkcí CheckFileCompliance má položka formát CODE: lidsky čitelný popis, kde CODE je jeden z pěticiferných kódů závad popsaných na stránce CheckFileCompliance (00002, 00003, 00005, 00006, 00007, 00011, 00012). Chcete-li s kódem pracovat programově, odstraňte prefix před dvojtečkou
Příklad
// 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;