ImportDocumentData

Document properties, Bookmarks

Description

Applies a plain-text document data dump: updates information keys, rebuilds the bookmark tree and replaces the page label ranges.

Syntax

Delphi

Function TPDFlib.ImportDocumentData(Const Data: WideString; Options: Integer): Integer;

Parameters

DataText in the format written by ExportDocumentData (the classic dump_data/update_info convention).
OptionsRecord kinds to process: 0 selects everything, otherwise combine bit 1 (document information keys), bit 2 (bookmarks) and bit 4 (page label ranges).

Return values

0No document is selected, the text is empty, or nothing applied.
NThe number of applied records (information keys, bookmarks and label ranges).

Remarks

Information keys update individually. The first bookmark record deletes the existing bookmark tree, then every record adds one bookmark whose parent is the most recent bookmark one level up (levels are clamped to at most one deeper than their predecessor). The first page label record clears the existing ranges. Out-of-range destination pages fall back to page 1, and unknown lines are ignored so future fields do not break older readers.

Example

PDF.ImportDocumentData(
  'BookmarkBegin'#13#10+
  'BookmarkTitle: Chapter 1'#13#10+
  'BookmarkLevel: 1'#13#10+
  'BookmarkPageNumber: 5'#13#10, 2);

See also

ExportDocumentData, NewOutline, SetInformation, AddPageLabels