Discussion:
[comtypes-users] comtypes and wxPython PDF support
Werner
2014-06-03 17:38:19 UTC
Permalink
Hi,

Following is not very detailed (mainly as I don't understand all the ins
and outs of it), so if I didn't provide something which might help
clarify things please let me know.

wxPython uses comtypes and ctypes for its PDF viewer and with
AcrobatReader 11.0.7 we see a hard crash.

To get the appropriate version of the Reader we do:

try: # Adobe Reader >= 7.0
cc.GetModule( ('{05BFD3F1-6319-4F30-B752-C7A22889BCC4}', 1, 0) )
progID = 'AcroPDF.PDF.1'
_min_adobe_version = 7.0
except:
try: # Adobe Reader 5 or 6
cc.GetModule( ('{CA8A9783-280D-11CF-A24D-444553540000}', 1,
0) )
progID = 'PDF.PdfCtrl.5'
_min_adobe_version = 5.0

The crash (it is hard with no exception) happens on this line of code:

hwnd = user32.CreateWindowExA(0, "AtlAxWin", axID,
WS_CHILD | WS_VISIBLE
| WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
x,y, w,h, parent.GetHandle(), None,
hInstance, 0)

On the Adobe support list we see an answer to VB users having a very
similar problem:

BeginQuote

With Reader 11.0.7, we (finally!) now provide a 64bit version of
AcroPDF.dll so that Reader can be used in 64bit browsers! Great news
for customers.

However, that means that anyone who built an application with an older
development environment (eg. VB6) that doesn't know from 64bit DLLs (or
"universal" 32/64bit DLLs) will no longer be able to load AcroPDF. As
these older environments have not been supported by Adobe for many years
now (I think we dropped support for VB6 around Acrobat 9), we didn't
test this scenario.

For those of you who are using modern development environment but had
previous built your apps as 32 bit (because of AcroPDF) - you can now
simply rebuild as either 64 only or "Any" and not only will things work
again but you're app will now be 64bit!

EndQuote

Is there something we can do on the wxPython side to force the loading
of 32bit or 64bit dll depending on what version of Python we are running.

Werner

Loading...