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_getpages.~pas

69 lines
1.5 KiB
Plaintext

11 months ago
unit u_op_seae_paper_getpages;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, OleServer, PDFTool_TLB, OleCtrls, PDFActiveXLib_TLB, ExtCtrls;
type
Tfrm_u_op_seae_paper_getpages = class(TForm)
pdfctvx1: TPDFActiveX;
pnl1: TPanel;
procedure FormCreate(Sender: TObject);
procedure ToOpenFile(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_getpages: Tfrm_u_op_seae_paper_getpages;
implementation
{$R *.dfm}
procedure Tfrm_u_op_seae_paper_getpages.FormCreate(Sender: TObject);
begin
//IntToStr( pdfpgtl1.GetPdfPage(path));
end;
procedure Tfrm_u_op_seae_paper_getpages.ToOpenFile(strpath:string);
begin
pdfctvx1.FPDF_OpenFile(strpath,'') ;
end;
function Tfrm_u_op_seae_paper_getpages.GetPDFPages(strpath:string):Integer;
begin
Result:=- 1 ;
try
if(FileExists(strpath) ) then
begin
ToOpenFile(strpath);
Result:= pdfctvx1.FPDF_GetPageCount;
//pdfctvx1.FPDF_CloseFile ();
if(Result<=0) then
showmessage(strpath+'<27><>ȡҳ<C8A1><D2B3>ʧ<EFBFBD><CAA7>!');
end
else
showmessage(strpath+'<27><><EFBFBD><EFBFBD><EFBFBD>ڻ<EFBFBD><DABB>߲<EFBFBD><DFB2>ɷ<EFBFBD><C9B7><EFBFBD>!');
except
end;
end;
procedure Tfrm_u_op_seae_paper_getpages.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
//
pdfctvx1. FPDF_ExitAppActiveX ();
end;
end.