Delphi:如何打印PDF而不显示? [英] Delphi: How to print a PDF without showing it?
问题描述
我正在打印一批PDF文档,不需要用户干扰。
打印PDF有一些不同的可能性...这取决于是否需要安装Adobe Reader不知道您是要分发您的工具还是自己使用它们。)
1)可以加载Adobe Reader的ActiveX控件并将其用于打印
pdfFile.src:='filename.pdf';
pdfFile.LoadFile('filename.pdf');
pdfFile.print;
2)您可以使用Adobe Reader自己打印PDF(也可以用FoxIt打印)
ShellExecute(0,'open','acrord32',PChar('/ p / h'+ FileName),nil,SW_HIDE)
3)您还可以使用Ghostview和Ghostprint
ShellExecute(Handle,'open','gsprint.exe',PChar('''+ filename +'''),'',SW_HIDE);
4)或者你可以使用第三方库...有一些可用但不是全部他们是免费的
- http://www.wpcubed.com/products/pdfviewer/index.htm
- http://www.quickpdflibrary.com/
- http://www.gnostice.com/PDFtoolkit_VCL.asp
I have been looking online for some time now, but I still haven't figured out how to print a PDF file in Delphi without showing the document itself, or a print dialog. I just want to open a file without showing it, and print it to the default printer.
I'm trying to print a batch of PDF documents, and there is no need for user interference.
There are some different possibilities to print PDFs... it depends whether you can require Adobe Reader to be installed (I don't know if you want to distribute your tool or just use it yourself).
1) It is possible to load the ActiveX control of Adobe Reader and use it for printing
pdfFile.src := 'filename.pdf';
pdfFile.LoadFile('filename.pdf');
pdfFile.print;
2) You can print PDFs with Adobe Reader itself (could be done with FoxIt too)
ShellExecute(0, 'open', 'acrord32', PChar('/p /h ' + FileName), nil, SW_HIDE);
3) You could also use Ghostview and Ghostprint
ShellExecute(Handle, 'open', 'gsprint.exe', PChar('"' + filename + '"'), '', SW_HIDE);
4) Or you could use a third party library... There are some available, but not all of them are free
- http://www.wpcubed.com/products/pdfviewer/index.htm
- http://www.quickpdflibrary.com/
- http://www.gnostice.com/PDFtoolkit_VCL.asp
这篇关于Delphi:如何打印PDF而不显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!