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;             // PDF 파일이 자동으로 표시됩니다

   HPDF.FileName := 'Outlines.pdf';  

   HPDF.BeginDoc( true );                   // PDF 파일 생성 with outlines

 

   OutlineRoot := HPDF.OutlineRoot;      // Get Outlines Root

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

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

 

   for I := 2 to 100 do

   begin

       CurrnetOutline := OutlineRoot.AddChild( 'Page ' + IntToStr(I - 1) );  // 현재 페이지의 0,0에 연결된 아웃라인 블록 추가

       CurrnetOutline.AddChild( 'Top ' );                                                 // 현재 페이지의 0,0에 연결된 아웃라인 추가

       CurrnetOutline.AddChild( 'Bottom ', 0, 800 );                                // 현재 페이지의 0,800에 연결된 아웃라인 추가

       HPDF.AddPage;                                                                         // Add Next Page

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

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

   end;

 

   CurrnetOutline := OutlineRoot.AddChild( 'Page 10 ' );             // 마지막 페이지 추가

   CurrnetOutline.AddChild( 'Top ' );                                         // 마지막 페이지의 0,0에 연결된 아웃라인 추가

   CurrnetOutline.AddChild( 'Bottom ', 0, 830 );                         // 마지막 페이지의 0,830에 연결된 아웃라인 추가

   HPDF.EndDoc;                                                                  // PDF 파일 닫기

finally

     HPDF.Free;

end;

end.