imagedemo.dpr

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

DPR
66
字号
{*******************************************************}
{                                                       }
{       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 ImageDemo;
{$APPTYPE CONSOLE}
uses
  SysUtils,
  Graphics,
  Classes,
  VPDFDoc;

var
   I: Integer;
   VPDF: TVPDF;
   Index: Integer;
   OutlineRoot: TVPDFDocOutlineObject;

begin
  VPDF:= TVPDF.Create(nil);
  try
    VPDF.AutoLaunch := true;                  // PDF file will be shown automatically
    VPDF.FileName := '.\ImageDemo.pdf';       // Set PDF filename
    VPDF.PageLayout := plOneColumn;           // One column viewer mode
    VPDF.BeginDoc( true );                    // Create PDF file with outlines

    OutlineRoot := VPDF.OutlineRoot;                // Get Outlines Root
    OutlineRoot.AddChild( 'Image rotation' );       // Add Outline block linked to 0, 0 in current page
    OutlineRoot.AddChild( 'Image zoom ', 0, 800 );  // Add Outline block linked to 0, 800 in current page

    VPDF.CurrentPage.SetFont('Arial', [fsBold, fsUnderline], 24); // Set font for header
    VPDF.CurrentPage.TextOut(200, 10, 0, 'VisPDF Image Demo');    // Print text
    Index := VPDF.AddImage( '.\Image.jpg', icJpeg );             // Add image to the document
    VPDF.CurrentPage.SetFont('Arial', [fsUnderline], 18);         // Set font for subheader
    VPDF.CurrentPage.TextOut(10, 40, 0, 'IMAGE ROTATION');        // Print text

    I := 0;
    while I < 360 do
    begin
        VPDF.CurrentPage.ShowImage( Index, 300, 130, 130, 100, I ); // Show image and rotate
        Inc(I, 30);
    end;

    VPDF.CurrentPage.TextOut(10, 400, 0, 'IMAGE ZOOM');           // Print text
    VPDF.CurrentPage.SetFont('Times New Roman', [], 14);          // Set font for text
    
    VPDF.CurrentPage.ShowImage( Index, 10, 430, 390, 300, 0 );    // Show image with sizes 390 x 300
    VPDF.CurrentPage.TextOut( 180, 730, 0, '390 X 300');          // Print text

    VPDF.CurrentPage.ShowImage( Index, 430, 430, 130, 100, 0 );   // Show image with sizes 130 x 100
    VPDF.CurrentPage.TextOut( 470, 530, 0, '130 X 100');          // Print text

    VPDF.EndDoc;                                            // Close PDF file
  finally
      VPDF.Free;
  end;
end.

⌨️ 快捷键说明

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