AddWebCaptureCommand

文件結構

描述

將一個 ISO Web Capture 命令字典加入所選文件的目錄 /SpiderInfo /C 陣列

語法

Delphi

Function AddWebCaptureCommand(Const Command: TPDFlibWebCaptureCommand): Integer;

傳回值

0命令未加入
N新附加命令以 1 為基準的位置,等於新的命令計數

失敗行為

在未選取任何文件、URL 為空、Levels 小於 1、Flags 為負或包含 PDF_WEB_CAPTURE_SAME_SITEPDF_WEB_CAPTURE_SAME_PATHPDF_WEB_CAPTURE_SUBMIT 以外的位元,或無法建立中繼資料物件時,傳回 0

備註

此函式會在需要時建立版本 1.0 的 /SpiderInfo 與命令陣列,將命令儲存為間接字典,並將文件的最小 PDF 版本提高至 1.3。空的 PostDataContentTypeHeaders 欄位會予以省略。此 API 僅管理 ISO Web Capture 命令中繼資料,不會擷取 URL、爬取網站或送出網路要求。相關讀取 API 使用的命令索引以 1 為基準

範例

Command.URL:= 'https://example.test/start';
Command.Levels:= 2;
Command.Flags:= PDF_WEB_CAPTURE_SAME_SITE;
Command.PostData:= '';
Command.ContentType:= '';
Command.Headers:= '';
Index:= PDF.AddWebCaptureCommand(Command);

另請參閱

TPDFlibWebCaptureCommand, GetWebCaptureCommand, GetWebCaptureCommandCount, ClearWebCaptureCommands