D10DJkaimengwenshang/public10/ThreeFun/Fun/U_printPdf.pas
DESKTOP-E401PHE\Administrator 74d01e92e1 ~
2025-09-27 14:24:10 +08:00

72 lines
2.3 KiB
ObjectPascal

unit U_printPdf;
interface
uses
Windows,forms;
// formId =1 功能id
//mRecid='文件表记录号'
//printNumber=1 打印份数
//printFlag=1 '打印预览;0立即打印
//DataBaseStr
function printPdf(App:Tapplication; FormID:integer;Title:PChar; GCode: PChar; GName: PChar;mRecid:PChar;printNumber:Integer;printFlag:Integer;printer:integer;DataBaseStr:PChar):hwnd;stdcall;external 'pdfPrint.dll' Name 'GetDllForm' ;
// formId =1 功能id
//mRecid='文件表记录号'
//printNumber=1 打印份数
//printFlag=1 '打印预览;0立即打印
//DataBaseStr
function printReport(App:Tapplication; FormID:integer;Title:PChar; GCode: PChar; GName: PChar;mRecid:PChar;printNumber:Integer;printFlag:Integer;printer:integer;DataBaseStr:PChar):hwnd;stdcall;external 'pdfPrint.dll' Name 'GetDllForm' ;
// formId =1 功能id
//mRecid='文件表记录号'
//exportFileType=1 导出文件类型 pdf ,bmp ,jpg
//DataBaseStr
//返回结果,保存文件的记录号 主键
function exportFile(App:Tapplication; FormID:integer;Title:PChar; GCode: PChar; GName: PChar;mRecid:PChar;exportFileType:PChar;DataBaseStr:PChar):hwnd;stdcall;external 'pdfPrint.dll' Name 'ExportFile' ;
function printPdf1(App:Tapplication; FormID:integer;Title:PChar; GCode: PChar; GName: PChar;mRecid:PChar;printNumber:Integer;printFlag:Integer;printer:integer;DataBaseStr:PChar):hwnd;
var
newh:hwnd;
implementation
function printPdf1(App:Tapplication; FormID:integer;Title:PChar; GCode: PChar; GName: PChar;mRecid:PChar;printNumber:Integer;printFlag:Integer;printer:integer;DataBaseStr:PChar):hwnd;
type
TMyFunc = function(App:Tapplication; FormID:integer;Title:PChar; GCode: PChar; GName: PChar;
mRecid:PChar;printNumber:Integer;printFlag:Integer;printer:integer;DataBaseStr:PChar):hwnd;stdcall;
var
Tf: TMyFunc;
Tp: TFarProc;
Th:Thandle;
begin
Th := LoadLibrary('pdfPrint.dll');
if Th > 0 then
begin
try
Tp := GetProcAddress(Th, 'GetDllForm');
if Tp <> nil then
begin
Tf := TMyFunc(Tp);
newh:=Tf(Application,1,
Title,
GCode,
GName,
mRecid,
printNumber,printFlag,printer,DataBaseStr
);
end
else
begin
//ShowMessage('打印执行错误');
end;
finally
// FreeLibrary(Th);
end;
end
else
begin
// ShowMessage('找不到'+Trim(DllName.Text));
end;
end ;
end.