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 עם outlines

   OutlineRoot := HPDF.OutlineRoot; // קבל את שורש ה-Outlines

   HPDF.CurrentPage.TextOut(0, 5, 0, ' Page 1 top'); // סמן את החלק העליון של העמוד הראשון

   HPDF.CurrentPage.TextOut(0, 830, 0, ' Page 1 bottom'); // סמן את החלק התחתון של העמוד הראשון

   for I := 2 to 100 do

begin

       CurrnetOutline := OutlineRoot.AddChild( 'Page ' + IntToStr(I - 1) ); // הוסף בלוק Outline המקשר ל-0,0 בעמוד הנוכחי

CurrnetOutline.Opened := true; // outline זה פתוח

       CurrnetOutline.AddChild( 'Top ' ); // הוסף Outline המקשר ל-0,0 בעמוד הנוכחי

       CurrnetOutline.AddChild( 'Bottom ', 0, 800 ); // הוסף Outline המקשר ל-0,800 בעמוד הנוכחי

       HPDF.AddPage; // הוסף את העמוד הבא

       HPDF.CurrentPage.TextOut( 0, 5, 0,' Page ' + IntToStr(I) + ' top' ); // סמן את החלק העליון של העמוד הבא

       HPDF.CurrentPage.TextOut( 0, 830, 0,' Page ' + IntToStr(I) + ' bottom' ); // סמן את החלק התחתון של העמוד הבא

end;

   CurrnetOutline := OutlineRoot.AddChild( 'Page 10 ' ); // הוסף את העמוד האחרון

   CurrnetOutline.AddChild( 'Top ' ); // הוסף Outline המקשר ל-0,0 בעמוד האחרון

   CurrnetOutline.AddChild( 'Bottom ', 0, 830 ); // הוסף Outline המקשר ל-0,830 בעמוד האחרון

   HPDF.EndDoc; // סגור קובץ PDF

finally

     HPDF.Free;

end;

end.