views:

522

answers:

5

I have imported Acrobat Reader using Components | Import Components. The AcroPdf_TLB unit is created in the Imports directory.

When I try to use the AcrobatReader component, as follows ...

AcroDoc := TAcroPDF.Create(nil);

... I get an 'Unspecified Error' exception (EOleSysError). Any ideas?

Thanks, Pieter.

A: 

Put the component on a TForm, then it probably works.

Lars D
I've tried that, but get the same error.
Pieter van Wyk
If creating it in code doesn't work, creating it in the form designer almost *never* will.
Mason Wheeler
Sometimes a component needs an owner in order to work.
Lars D
A: 

The Acrobat ActiveX/COM object is notorious for not supporting interfaces of older versions properly. You get EOleSysErrors all over the place.

What I have personally done for a couple of clients, is load the PDF documents in a TWebBrowser.

TWebBrowser is a wrapper around the ActiveX/COM component that Internet explorer uses to display everything.

Adobe is pretty good in making that work with each Acrobat update, so the TWebBrowser then also works.

Note that this only makes sense for displaying the PDF document.

--jeroen

Jeroen Pluimers
Thanks, that does work for displaying the pdf document but I need to print the document silently from a ReportBroker we use to distribute reports to clients.
Pieter van Wyk
+1  A: 

If you are unhappy with the results you are getting there (I was), you might consider giving QuickPDF a try. The price is not unreasonable, they have lots of good PDF functions included and you can display a PDF accurately in a TImage control with a call to RenderPageToStream. One thing I discovered working with form fields is that I had to use their FlattenFormField before rendering to get the form field contents to be included in the rendered image.

Follow up:

I did not mention originally that QuickPDF also works for printing. For form fields, you have to do the same FlattenFormField routine, but the results look good with much less overhead than relying on Acrobat Reader.

QuickPDF would probably have been the way to go, but funding was not forthcoming so I could not go down that route.
Pieter van Wyk
A: 

We use the Adobe Reader plug-in and face this issue often. It particularly surfaces after a user performs a web-update on the Adobe Reader.

Try un-installing (via the Control Panel), then re-installing the latest Adobe Reader.

That invariably clears the issue for our users.

EagleOfToledo
Please note that re-installing alone will not fix the issue, a full un-install of the Reader is required first.
EagleOfToledo
A: 

We successfully used the acrobat v6 reader component in our Delphi 7 app, but found that it really requires acrobat v6. Users today who install only acrobat v9 get an error when they use our app to view a pdf because the acrobat component is not backward compatible in this way.

So yes, you can do it, but there are probable issues going forward.

A third party tool is prob best...

Jon Samson