program Outlines;

{$APPTYPE CONSOLE}

uses

SysUtils,

Graphics,

Classes,

HPDFDoc;

 

var

  I: Integer;

  HPDF: THotPDF;

  OutlineRoot: THPDFDocOutlineObject;

  CurrnetOutline: THPDFDocOutlineObject;

 

begin

HPDF:= THotPDF.Create(nil);

try

   HPDF.AutoLaunch := true;             // The PDF file will be shown automatically

   HPDF.FileName := 'Outlines.pdf';  

   HPDF.BeginDoc( true );                   // Create the PDF file with outlines

 

   OutlineRoot := HPDF.OutlineRoot;      // Get the outlines root

   HPDF.CurrentPage.TextOut(0, 5, 0, '  Page 1 top');          // Mark the first page top

   HPDF.CurrentPage.TextOut(0, 830, 0, '  Page 1 bottom');      // Mark the first page bottom

 

   for I := 2 to 100 do

   begin

       CurrnetOutline := OutlineRoot.AddChild( 'Page ' + IntToStr(I - 1) );  // Add an outline block linked to 0,0 in the current page

       CurrnetOutline.AddChild( 'Top ' );                                                 //  Add an outline linked to 0,0 in the current page

       CurrnetOutline.AddChild( 'Bottom ', 0, 800 );                                //  Add Outline linked to 0,800 in current page

       HPDF.AddPage;                                                                         // Add the next page

       HPDF.CurrentPage.TextOut(0, 5,  0,'  Page ' + IntToStr(I) + ' top');   // Mark the next page top

       HPDF.CurrentPage.TextOut(0, 830,  0,'  Page ' + IntToStr(I) + ' bottom'); // Mark the next page bottom

   end;

 

   CurrnetOutline := OutlineRoot.AddChild( 'Page 10 ' );             // Add the last  page

   CurrnetOutline.AddChild( 'Top ' );                                         //  Add an outline linked to 0,0 in the last page

   CurrnetOutline.AddChild( 'Bottom ', 0, 830 );                         //  Add an outline linked to 0,830 in the last page

   HPDF.EndDoc;                                                                  // Close the PDF file

finally

     HPDF.Free;

end;

end.