[python-win32] Acrobat Reader

Waldemar Osuch waldemar.osuch at gmail.com
Thu Apr 6 21:46:19 CEST 2006


On 4/6/06, Tim Roberts <timr at probo.com> wrote:
> On Wed, 5 Apr 2006 11:55:18 -0600, "Waldemar Osuch"
> <waldemar.osuch at gmail.com> wrote:
>
> >I know Dispatch used to work with the Reader.  Did Adobe broke the
> >Reader to force us to pay for the full version or is it pythoncom at
> >fault here?
>
> The Acrobat 5 Reader exposed an AcroExch.App object, but (according to
> Google) was an accident. They didn't mean to expose that unless you had
> purchsed the full product.
>
> >But then again I have working .Net application that uses Reader to
> >display files.
> >I did not write the .Net one so do not ask me how it does it  :-) .
> >But I do have source and could try to find out.
>
> That would be interesting to know. If it is using it as a hosted ActiveX
> control, rather than a simple COM object, that could be the difference.
>
I did try but I'm over my head.  Nothing beats reading Python code :-)
This is what I found out:
The .Net solution has two Acrobat related references:
- AcroPDFLib with name: Interop.AcroPDFLib
- AcAcroPDFLib with name: AxInterop.AcroPDFLib

The control is instantiated like this:
this.axPdfBrowser = new AxAcroPDFLib.AxAcroPDF();

and initialized like this:
this.axPdfBrowser.ContainingControl = this;
this.axPdfBrowser.Dock = System.Windows.Forms.DockStyle.Fill;
this.axPdfBrowser.Enabled = true;
this.axPdfBrowser.Location = new System.Drawing.Point(2, 2);
this.axPdfBrowser.Name = "axPdfBrowser";
this.axPdfBrowser.OcxState =
((System.Windows.Forms.AxHost.State)(resources.GetObject("axPdfBrowser.OcxState")));
this.axPdfBrowser.Size = new System.Drawing.Size(729, 376);
this.axPdfBrowser.TabIndex = 12;
this.axPdfBrowser.Visible = false;

Also I found this article explaining how to use it from MFC.
Does it make sense?
http://www.codeproject.com/miscctrl/acroview.asp

> >>> The Acrobat ActiveX wrapper in wxPython explodes with version 7, deep
> >>> within Acrobat, where it has never done so before.  The problem has not
> >>> been isolated yet.
> >
> >It is the same issue.  I think.
>
> The failure mode is different. The AcroPDF.PDF / LoadFile thing crashes
> very early, only about two calls deep into acropdf.dll, dereferencing a
> null pointer. Is it possible that the LoadFile API requires some other
> parameter that is defaulting to NULL?
>
> >>>
> >>> The only reliable and portable way to do what you ask is to fire up the
> >>> reader from a command line.
> >
> >Yes but then you can not control it at all.
>
>
> There is a command-line parameter asking it to print the file
> immediately.  For many purposes, that is enough.
>
I have tried the suggestion to control the Reader using
InternetExplorer and it works nicely.

Waldemar


More information about the Python-win32 mailing list