Use Adobe Acrobat (PDF) Files in a Delphi Application

Delphi supports the display of Adobe PDF files from within an application. As long as you've got Adobe Reader installed, your PC will automatically have the relevant ActiveX control you'll need to create a component you can drop into a Delphi form.

Difficulty: Easy

Time Required: 5 minutes

Here's How:

  1. Start Delphi and select Component | Import ActiveX Control...
  2. Look for the "Acrobat Control for ActiveX (Version x.x)" control and click Install.
  1. Select the Component palette location into which the selected library will appear. Click Install.
  2. Select a package where the new component must be installed or create a new package for the new TPdf control.
  3. Click OK.
  4. Delphi will ask you whether you want to rebuild the modified/new package. Click Yes.
  5. After the package is compiled, Delphi will show you a message saying that the new TPdf component was registered and already available as part of the VCL.
  6. Close the package detail window, allowing Delphi to save the changes to it.
  7. The component is now available in the ActiveX tab (if you didn't change this setting in step 4).
  8. Drop the TPdf component onto a form and then select it.
  9. Using the object inspector, set the src property to the name of an existing PDF file on your system. Now all you have to do is resize the component and read the PDF file from your Delphi application.

Tips:

  • The Adobe ActiveX control installs automatically when you install Adobe Reader. 
  • Step 11 can be completed during runtime, so you can open and close files programmatically as well as resize the control.