graphicdraw.dpr

来自「生成PDF文档的控件」· DPR 代码 · 共 62 行

DPR
62
字号
{*******************************************************}
{                                                       }
{       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                           }
{                                                       }
{*******************************************************}

program GraphicDraw;

{$APPTYPE CONSOLE}

uses
  SysUtils, Graphics, Classes, Windows, VPDFDoc;

var
   VPDF: TVPDF;
   DashArray: array of byte;
   OutlineRoot: TVPDFDocOutlineObject;
   CurrnetOutline: TVPDFDocOutlineObject;

   procedure DrawLine( Y : Integer );
   begin
       VPDF.CurrentPage.MoveTo( 160, Y);
       VPDF.CurrentPage.LineTo( 310, Y);
       VPDF.CurrentPage.Stroke;
   end;

var
    i: Integer;

begin
    Randomize;
    VPDF:= TVPDF.Create(nil);
    try
        VPDF.AutoLaunch := true;              // PDF file will be shown automatically
        VPDF.NotEmbeddedFonts.Add('Arial');
        VPDF.StandardFontEmulation := true;
        VPDF.FileName := '.\GraphicDraw.pdf';     // Set PDF filename
        VPDF.Compression := cmNone;               // Set flate compression
        VPDF.PageLayout := plOneColumn;           // One column viewer mode
        VPDF.BeginDoc( true );                    // Create PDF file
        OutlineRoot := VPDF.OutlineRoot;          // Get Outlines Root
        CurrnetOutline := OutlineRoot.AddChild( 'Lines' );          // Add Outline block linked to 0, 0 in current page
        CurrnetOutline.Opened := true;                              // Current outline is opened;
        VPDF.CurrentPage.SetFont('Arial', [fsBold, fsUnderline], 16);  // Show page header
        VPDF.CurrentPage.TextOut( 150, 25, 0, 'Examples of line dash patterns' );
        VPDF.CurrentPage.SetFont('Arial', [], 12);  // Show next header
        VPDF.CurrentPage.SetLineWidth( 3 );
        VPDF.CurrentPage.SetRGBStrokeColor( clBlue );   // Set blue line color
        VPDF.CurrentPage.TextOut( 70, 70, 0, '[ ] 0                                                                          No dash; solid, unbroken lines' );
        DrawLine( 77 );
        SetLength(DashArray, 1);
        //-------------------------  Examples of line dash patterns  -----------------------------------------------//
        CurrnetOutline.AddChild( 'Dash patterns', 150, 25 );          // Add Outline block linked to 150, 25 in current page
        DashArray[0] := 7;
        VPDF.CurrentPage.SetDash( DashArray, 0 );  // Set dash array [7] 0
        VPDF.CurrentPage.TextOut( 70, 90, 0, '[7] 0                                                                         7 units on, 7 units off, 

⌨️ 快捷键说明

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