在Delphi 2009中显示PDF文件的最佳方法是什么 [英] What is the best way to display a PDF file in Delphi 2009
问题描述
我应该使用什么组件在Delphi 2009应用程序中显示PDF文件?
What component should I use to display a PDF file in a Delphi 2009 application?
我一直在使用Synactis的 PDF查看器-一个非常漂亮的免费PDF查看器 但是它没有Delphi 2009支持.
I have been using PDF Viewer by Synactis - a very nice free PDF Viewer But it has no Delphi 2009 support.
所以我需要从产品中进行设计
So I need to designing it out of the product
推荐答案
我们将Acrobat Reader嵌入了我们的Delphi应用程序中. 看看这篇文章"如何将Adobe Acrobat嵌入到您的应用程序中". 将Acrobat Reader ActiveX组件添加到窗体后,可以使用以下代码:
We embedded the Acrobat Reader in our Delphi application. Take a look at this article "How to embed Adobe Acrobat into your application". Once you have added the Acrobat Reader ActiveX component to your Form you can use following code:
procedure TForm1.Button1Click(Sender: TObject);
begin
// This example assumes that you have a TOpenDialog
// and TPdf dropped onto your form
OpenDialog1.Filter := 'PDF Files (*.pdf)|*.pdf';
if OpenDialog1.Execute then
Pdf1.src := OpenDialog1.FileName;
end;
有本地的Delphi组件,但嵌入Acrobat Reader组件可以满足我们的需求.
There is native Delphi components out there but embedding the Acrobat Reader component served our needs.
这篇关于在Delphi 2009中显示PDF文件的最佳方法是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!