|
Determines whether the current outline item is opened.
Delphi 语法:
property Opened : boolean;
C++ 语法:
__property bool Opened;
说明
Use Opened property to open ( true value ) outline item or close ( false value ) outline item
子项添加之前或之后都可以设置该状态。写出文档时,打开的条目会记录它可见的后代数,闭合的条目记录取负后的数量(即打开后会显示的数量),大纲根则记录起始时可见的条目数
默认值:false(opt-in,用于保留文本 xref table,以兼容硬编码 xref 关键字的工具,并最大化 PDF 1.4 / 更早阅读器兼容性)
代码示例
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 file will be shown automatically
HPDF.FileName := '.\Outlines.pdf'; // Set PDF filename
HPDF.BeginDoc( true ); // Create PDF file 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) ); // Add Outline block linked to 0,0 in current page
CurrnetOutline.Opened := true; // This outline is opened
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' ); // Mark Next page top
HPDF.CurrentPage.TextOut( 0, 830, 0,' Page ' + IntToStr(I) + ' bottom' ); // Mark Next page bottom
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; // Close PDF file
finally
HPDF.Free;
end;
end.
|