In an application where a user's PDF report can be previewed using
Acrobat reader in a wx.PDFWindow, if any changes are required, it is
necessary to force Acrobat to release the PDF file before it can be
updated. I do this using the sequence of calls:
pdfwin.LoadFile(reportfile)
pdfwin.LoadFile(blankfile)
pdfwin.LoadFile([modified]reportfile)
However, this causes Acrobat reader to completely close down and re-open
every time LoadFile is called, taking tens of seconds each time (A new PID
can be seen in Windows Task Manager every time this happens).
This can be prevented by holding the original Acrobat process open using
another instance of wx.PDFWindow. For example by creating a dummy dialog,
that is never shown, which contains a PDFWindow and a call to
LoadFile(blankfile). At the end of the program it is necessary to call
dummydialog.Destroy() in order to release everything.
Maybe this is something that could eventually be done internally in the
ActiveX clockwork of wxWidgets, and there are some other things that would
help to make the behaviour a bit more intelligent as well. For exampe, if
there is already an Acrobat Reader process running when the program starts
(eg Acrobat Reader itself or the wxPython demo) then the program will use
it. But if the other activity closes, wx.PDFWindow continues quite
happily, but displaying a blank window.
Regards,
David Hughes
Forestfield Software
www.foresoft.co.uk