delphi quick pdf library打印PDF很方便

// 事先需要安装foxit quick pdf library ,安装完成,把DebenuPDFLibraryDLL1811.pas文件添加你的项目文件内
// 把DebenuPDFLibraryDLL1811.dll动态库复制到你执行程序目录
// 执行调用指定打印机打印PDF文件
var
PDFLibrary: TDebenuPDFLibraryDLL1811; UnlockResult: Integer; CustomPrinter:string; iPrintOptions: Integer; begin PDFLibrary := TDebenuPDFLibraryDLL1811.Create(ExtractFilePath(Application.ExeName) + 'DebenuPDFLibraryDLL1811.dll'); try UnlockResult := PDFLibrary.UnlockKey('quick pdf key'); // 需要软件密钥,去网上找个破解的密钥 if UnlockResult = 1 then begin PDFLibrary.LoadFromFile(Edit3.Text, ''); CustomPrinter := PDFLibrary.NewCustomPrinter('Microsoft Print to PDF'); // 自定义打印机 iPrintOptions := PDFLibrary.PrintOptions(0, 0, 'Hello World.pdf'); PDFLibrary.PrintDocument(CustomPrinter, 1, 1, iPrintOptions); // PDFLibrary.PrintDocument(PDFLibrary.GetDefaultPrinterName, 1, 1, iPrintOptions); // 默认打印机打印 end else begin ShowMessage('Invalid license key'); end; finally PDFLibrary.Free; end;

posted @ 2023-01-01 15:40  夏天的西瓜君  阅读(1113)  评论(0编辑  收藏  举报