⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.pas

📁 生成PDF文档的控件
💻 PAS
字号:
{*******************************************************}
{                                                       }
{       This unit is part of the VISPDF VCL library.    }
{       Written by R.Husske - ALL RIGHTS RESERVED.      }
{                                                       }
{       Copyright (C) 2000-2008, www.vispdf.com         }
{                                                       }
{       e-mail: support@vispdf.com                      }
{       http://www.vispdf.com                           }
{                                                       }
{*******************************************************}

unit Main;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, VPDFDoc;

type
  TForm1 = class(TForm)
    VPDF: TVPDF;
    Label1: TLabel;
    FileNameEdit: TEdit;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var
   I: Integer;
   OutlineRoot: TVPDFDocOutlineObject;
   CurrnetOutline: TVPDFDocOutlineObject;
begin
    VPDF.FileName := FileNameEdit.Text;    // Set PDF filename
    VPDF.BeginDoc( true );                // Create PDF file with outlines
    OutlineRoot := VPDF.OutlineRoot;      // Get Outlines Root
    VPDF.CurrentPage.TextOut(0, 5, 0, '  Page 1 top');           // Mark first page top
    VPDF.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.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
        VPDF.AddPage;                                                     // ADD Next Page
        VPDF.CurrentPage.TextOut(0, 5,  0,'  Page ' + IntToStr(I) + ' top');      // Mark Next page top
        VPDF.CurrentPage.TextOut(0, 830,  0,'  Page ' + IntToStr(I) + ' bottom'); // Mark Next page bottom
    end;
    CurrnetOutline := OutlineRoot.AddChild( 'Page 100 ' );             // 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
    VPDF.EndDoc;                                            // Close PDF file
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -