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

📄 mainunit.cpp

📁 生成PDF文档的控件
💻 CPP
字号:
//*******************************************************//
//                                                       //
//       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                           //
//                                                       //
//*******************************************************//

#include <vcl.h>
#pragma hdrstop

#include "MainUnit.h"

#pragma package(smart_init)
#pragma resource "*.dfm"
TMainForm *MainForm;

__fastcall TMainForm::TMainForm(TComponent* Owner)
        : TForm(Owner)
{
}

void __fastcall TMainForm::Button1Click(TObject *Sender)
{
    TVPDFCurrPoint BeginPoint;
    TVPDFCurrPoint EndPoint;

    VPDF->BeginDoc(false);                 // Create PDF document

    VPDF->CurrentPage->AddTextAnnotation( "Text annotations example", Rect(10, 10, 20, 20), true, taComment, clBlue ); // Draw text annotation

    VPDF->CurrentPage->AddFreeTextAnnotation( "Free text annotations example", Rect(10, 160, 200, 220), ftLeftJust, clRed ); // Draw free text annotation

    BeginPoint.X = 10;
    BeginPoint.Y = 230;
    EndPoint.X = 100;
    EndPoint.Y = 290;

    VPDF->CurrentPage->AddLineAnnotation( "Line annotation example", BeginPoint, EndPoint, clYellow); // Draw line annotation

    VPDF->CurrentPage->AddCircleSquareAnnotation( "Circle annotation example", Rect(10, 300, 200, 330), csCircle, clGreen ); // Draw circle and square annotation

    VPDF->CurrentPage->AddStampAnnotation("Stamp annotation example", Rect(313, 20, 475, 120), satDraft, clPurple); // Draw stamp annotation

    VPDF->CurrentPage->AddFileAttachmentAnnotation("File attach annotation example", "License.txt", Rect(300, 160, 450, 200), clLime); // Draw file attachment annotation

    VPDF->CurrentPage->AddSoundAnnotation( "Sound Annotation demo", "Music.wav", Rect(300, 230, 450, 250), 0x550000); // Draw sound annotation

    VPDF->CurrentPage->AddMovieAnnotation( "Movie annotation demo", "Clock.mov", Rect(300, 290, 450, 370), clGreen ); // Draw movie annotation

    VPDF->EndDoc();                   // Close PDF document

}

⌨️ 快捷键说明

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