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;             // O arquivo PDF será exibido automaticamente

   HPDF.FileName := 'Outlines.pdf';  

   HPDF.BeginDoc( true );                   // Cria o arquivo PDF com outlines

 

   OutlineRoot := HPDF.OutlineRoot;      // Obtém a raiz dos outlines

   HPDF.CurrentPage.TextOut(0, 5, 0, '  Page 1 top');          // Marca o topo da primeira página

   HPDF.CurrentPage.TextOut(0, 830, 0, '  Page 1 bottom');      // Marca o rodapé da primeira página

 

   for I := 2 to 100 do

   begin

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

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

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

       HPDF.AddPage;                                                                         // Add Next Page

       HPDF.CurrentPage.TextOut(0, 5,  0,'  Page ' + IntToStr(I) + ' top');   // Marca o topo da próxima página

       HPDF.CurrentPage.TextOut(0, 830,  0,'  Page ' + IntToStr(I) + ' bottom'); // Marca o rodapé da próxima página

   end;

 

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

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

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

   HPDF.EndDoc;                                                                  // Fecha o arquivo PDF

finally

     HPDF.Free;

end

end