You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS6JIEFENG/海运业务/u_op_seae_paper_getpages2.pas

99 lines
1.9 KiB
Plaintext

unit u_op_seae_paper_getpages2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, OleServer, OleCtrls, ExtCtrls,
iWebPDFEditorLib_TLB, AcroPDFLib_TLB, PDFActiveXLib_TLB;
type
Tfrm_u_op_seae_paper_getpages2 = class(TForm)
pnl1: TPanel;
iwbpdfdtr1: TiWebPDFEditor;
procedure FormCreate(Sender: TObject);
procedure ToOpenFile(strpath:string);
procedure PrintPDFFile(strpath:string);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
function GetPDFPages(strpath:string):Integer;
end;
var
frm_u_op_seae_paper_getpages2: Tfrm_u_op_seae_paper_getpages2;
implementation
{$R *.dfm}
procedure Tfrm_u_op_seae_paper_getpages2.FormCreate(Sender: TObject);
begin
//IntToStr( pdfpgtl1.GetPdfPage(path));
end;
procedure Tfrm_u_op_seae_paper_getpages2.ToOpenFile(strpath:string);
begin
iwbpdfdtr1.LoadFromFile(strpath) ;
end;
function Tfrm_u_op_seae_paper_getpages2.GetPDFPages(strpath:string):Integer;
begin
Result:=- 1 ;
try
if(FileExists(strpath) ) then
begin
try
ToOpenFile(strpath);
Result:= iwbpdfdtr1.PageCount;
iwbpdfdtr1.CloseRead();
except
end;
if(Result<=0) then
showmessage(strpath+'获取页数失败!');
end
else
showmessage(strpath+'不存在或者不可访问!');
except
end;
end;
procedure Tfrm_u_op_seae_paper_getpages2.PrintPDFFile(strpath: string);
begin
try
if(FileExists(strpath) ) then
begin
{
acrpdf1.LoadFile(strpath);
acrpdf1.Print;
}
end
else
showmessage(strpath+'不存在或者不可访问!');
except
end;
end;
procedure Tfrm_u_op_seae_paper_getpages2.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
iwbpdfdtr1.Destroy;
Action:=caFree;
end;
end.