Repository navigation
Expand file tree
/
Copy pathPDFViewerMain.pas
More file actions
78 lines (66 loc) · 1.75 KB
/
Copy pathPDFViewerMain.pas
File metadata and controls
78 lines (66 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
unit PDFViewerMain;
interface
uses
AcroPDFLib_TLB,
System.Classes,
System.SysUtils,
System.Variants,
Vcl.Controls,
Vcl.Dialogs,
Vcl.Forms,
Vcl.Graphics,
Vcl.Menus,
Vcl.OleCtrls,
Winapi.Messages,
Winapi.Windows;
type
TPDFForm = class( TForm )
AcroPDF: TAcroPDF;
MainMenu: TMainMenu;
File1: TMenuItem;
OpenFile: TMenuItem;
ExitApplication: TMenuItem;
N1: TMenuItem;
Options: TMenuItem;
ToolbarVisibilty: TMenuItem;
OpenPDFDialog: TOpenDialog;
procedure ExitApplicationClick( Sender : TObject );
procedure OpenFileClick( Sender : TObject );
procedure ToolbarVisibiltyClick( Sender : TObject );
private
{ Private declarations }
public
{ Public declarations }
end;
var
PDFForm: TPDFForm;
implementation
{$R *.dfm}
procedure TPDFForm.ExitApplicationClick( Sender : TObject );
begin
Self.Close();
end;
procedure TPDFForm.OpenFileClick( Sender : TObject );
begin
if( OpenPDFDialog.Execute ) then
if not( AcroPDF.LoadFile( OpenPDFDialog.FileName ) ) then
MessageDlg( 'Error opening PDF', TMsgDlgType.mtError, mbOKCancel, 0 )
else
AcroPDF.LoadFile( OpenPDFDialog.FileName );
PDFForm.Caption := 'PDF Viewer - ' + ExtractFileName( OpenPDFDialog.FileName );
Options.Enabled := True;
end;
procedure TPDFForm.ToolbarVisibiltyClick( Sender : TObject );
begin
if( ToolbarVisibilty.Caption = '&Show Toolbar' ) then
begin
AcroPDF.setShowToolbar( True );
ToolbarVisibilty.Caption := '&Hide Toolbar';
end
else
begin
AcroPDF.setShowToolbar( False );
ToolbarVisibilty.Caption := '&Show Toolbar';
end;
end;
end.