Главная страница | назад





Article #22101: How to embed Adobe Acrobat into your application.

Question:
How can I embed Adobe Acrobat into my application so users can read PDF files?

Answer:
This document describes the process on how to use Adobe Acrobat to display files inside of your application.

  1. First, you will have to ensure that you have the latest version of Acrobat on your machine. You can download it from Adobe.
  2. Next you will need to import the type library for Acrobat, and be sure to click the Install button to install it into the IDE:
    Import Picture
  3. You can now drop a TPdf component onto your form and use it however you like.

-- Tips --

To set the file that you want open, use the src property, such as:

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;

If you don't want the Acrobat toolbar to be shown, you can call Pdf1.setShowToolbar(false);. You can then have custom buttons that allow the user to navigate through the PDF document by calling gotoFirstPage, gotoLastPage, setZoom(percent: Single), etc. To find out a list of all the functions you can call, open the file that you imported (it is probably called PdfLib_TLB.pas), and look at all the functions in the class TPdf = class(TOleControl). To easily browse to this file, you can place the cursor over the PdfLib_TLB name in the uses clause and press Ctrl-Enter.

Last Modified: 31-MAY-00