|
AddTOCItem function (TgtCustomPlainsheetEngine) |
Top |
|
function AddTOCItem(Caption: WideString; ParentNode: Integer; URL: string): Integer; virtual;
function AddTOCItem(Caption: WideString; ParentNode, PageNumber: Integer; Top: Double): Integer; virtual; overload;
Description
This method is invoked to add an entry into the TOC (Table of Contents).
Call AddTOCItem with Caption, ParentNode, PageNumber and Top to add an item to the Table of Contents page and link it to the position specified by Top in the page specified by the PageNumber of the generated document.
Call AddTOCItem with Caption, ParentNode, and URL to add an item to the Table of contents which will link to the URL.
Caption indicates the name of the TOC item. ParentNode indicates the node for which the item to be added becomes the child.
Return: It will return an identifier to the entry which can be used in subsequent calls as ParentNode.
Example:
Delphi:
with gtPDFEngine1 do begin FileName := 'TableOfContents'; BeginDoc; //Root node - pointing to top of 3rd page. I1 := AddTOCItem('Item 1', -1, 3, 0); //Subnode - pointing to an URL. I2 := AddTOCItem('Item 1.1', I1, 'http://www.gnostice.com'); //Subnode to URL - pointing to 2nd page. AddTOCItem('Item 1.1.1', I2, 2, 3); //SubNode to root node - pointing to 1st page. AddTOCItem('Item 1.2', I1, 1, 1); //...Add more TOC items as required.
EndDoc; end;
C++Builder:
gtPDFEngine1->FileName = "TableOfContents"; gtPDFEngine1->BeginDoc(); //Root node - pointing to top of 3rd page. I1 = gtPDFEngine1->AddTOCItem("Item 1", -1, 3, 0); //Subnode - pointing to an URL. I2 = gtPDFEngine1->AddTOCItem("Item 1.1", I1, "http://www.gnostice.com"); //Subnode to URL - pointing to 2nd page. gtPDFEngine1->AddTOCItem("Item 1.1.1", I2, 2, 3); //SubNode to root node - pointing to 1st page. gtPDFEngine1->AddTOCItem("Item 1.2", I1, 1, 1); //...Add more TOC items as required.
gtPDFEngine1->EndDoc(); |