views:

68

answers:

2

Hello, I have a simple Win32 app writen in C, in which I would like to open PDFs. I know I can compile and link to Poppler library, but is there a way to use Acrobat Reader? Kind of like what browsers do, if you have Reader installed, they are automatically able to display PDF in a window though some plugin interface. The problem is, I never used a plugin, not wrote such an interface. How to? Is it also possible to install Reader afterward and somehow make the app aware of its presence?

I would also like to control, say, the zoom. And what the PDF could be in memory, as well.

Edit:

I just found this [1]: "If you have installed Adobe Reader, you can add a COM reference to the PDf viewer ActiveX control in VisualStudio and use it inside a WindowsFormsHost control." but I don't understand what does it says: how do I create "COM reference" and use "WindowsFormsHost" in plain Win32 C?

[1] http://stackoverflow.com/questions/2014658/pdf-libraries-to-display-a-pdf-document-in-wpf

A: 

On windows if you type mypdf.pdf and hit return in a Command Prompt it opens the pdf in the associated application (in most cases Adobe Reader). So in c# I start a new process with the pdf as the file to run.

You should be able to do something similar in c without bothering with plugins.

Nifle
Yes, but I also would like to control, say, the zoom. And what the PDF could be in memory, as well..
Lars Kanto
@Lars - I'm pretty sure you can't automate Adobe Reader at all. You'll need a third party plug-in to do that.
Nifle
What do you mean by "3rd party"? A plugin for Acrobat? Which in turn is controlled by my app?
Lars Kanto
@Lars - I may have been unclear I did not mean that `you'll need a plug-in to control Adobe Reader` (I don't think there is one). I meant some code, a library or a dll (that can render the pdf) provided by someone else that you can control from your application (like poppler that you mentioned).
Nifle
That's so unfortunate... Cocoa has PDFKit, Poppler is extremely slow.
Lars Kanto
A: 

In addition to what Nifle said, if instead of running it as a separate application you want to run Acrobat Reader as a plugin within your application's window (as for example IE runs it within IE's window), Adobe Acrobat Reader download page says,

An ActiveX control for Internet Explorer and a plug-in for Netscape Navigator are included and automatically installed in the browser of your choice.

The plug-in technology is probably the technology called ActiveX.

ChrisW