What is the best way to display a PDF file in Delphi 2009 [closed]

为君一笑 提交于 2019-12-18 13:25:52

问题


What component should I use to display a PDF file in a Delphi 2009 application?

EDIT:

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


回答1:


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;

There is native Delphi components out there but embedding the Acrobat Reader component served our needs.




回答2:


I have a feeling that more and more users prefere alternatives to acrobat reader, so forcing them to install acrobat to use your progam is a bad idea.

The ProPlus version of Gnistice PDFtoolkit let you display pdf files. And so does QuickPDFLibrary. I'm sure there are more of them.

Launching the file in the users prefered pdf viewer could be a second option for better controlling printing etc.




回答3:


If all you want to achieve is displaying a pdf, why not just start the application the user installed for viewing pdf files? This way they won't get annoyed by your program ignoring their choice and will also be already familiar with the program.

Other options include using Adobe's acrobat reader plugin as Kris De Decker suggests or the plugins I am sure alternative viewers also supply. This will potentially give you some more control, but you will for sure also find that the control is not as thorough as you would like.




回答4:


It is possible to use a Twebbrowser or a Bsalsa web document, URL encode the filepath and pass it as a web document - it will load the default PDF application within the browser area.




回答5:


WPCubed (http://wptools.de/) offers WPViewPDF tools with a royalty free distribution license, and Delphi support - 4,5,6,7, 2005, 2006, 2007, BCB 5,6,2006, 2007




回答6:


I have not used the wptools PDF viewer, but I can say their other PDF tools are top notch.




回答7:


Embeded original Acrobat Reader ActiveX in Delphi is the best way and free. If you want to create PDF, that's cost a lot.



来源:https://stackoverflow.com/questions/624246/what-is-the-best-way-to-display-a-pdf-file-in-delphi-2009

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!