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

Charles Faiga picture Charles Faiga · Mar 8, 2009 · Viewed 27.9k times · Source

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

Answer

Kris De Decker picture Kris De Decker · Mar 8, 2009

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.