AddWebCaptureCommand

Document structure

Description

Adds one ISO Web Capture command dictionary to the selected document's catalog /SpiderInfo /C array

Syntax

Delphi

Function AddWebCaptureCommand(Const Command: TPDFlibWebCaptureCommand): Integer;

Return values

0The command was not added
NThe 1-based position of the newly appended command, equal to the new command count

Failure behaviour

Returns 0 when no document is selected, URL is empty, Levels is less than 1, Flags is negative or contains bits other than PDF_WEB_CAPTURE_SAME_SITE, PDF_WEB_CAPTURE_SAME_PATH and PDF_WEB_CAPTURE_SUBMIT, or the metadata objects cannot be created

Remarks

The function creates /SpiderInfo with version 1.0 and a command array when needed, stores the command as an indirect dictionary, and raises the document's minimum PDF version to 1.3. Empty PostData, ContentType and Headers fields are omitted. This API only manages ISO Web Capture command metadata and does not fetch URLs, crawl sites or submit network requests. Command indexes used by the related read API are 1-based

Example

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

See also

TPDFlibWebCaptureCommand, GetWebCaptureCommand, GetWebCaptureCommandCount, ClearWebCaptureCommands