ActiveX Adobe PDF Reader - close document

I’m using the Adobe PDF Reader ActiveX component in an application to view PDF files. It is working well enough and I am able to do everything I need to do except one thing…close the PDF file when I’m done with it.

I don’t want to close the OLEContainer. I would like for it to remain in place as it was before a PDF was opened.

I would also not like to go out my my way trying to rig this to appear that it’s working properly and just close the PDF.

I tried using HTMLViewer, but there were visual problems, mainly with zoom functionality.

I’ve tried to figure this out in code, searched the net, etc. No luck. There has to be a simple command to close the PDF it just opened, right?

Any ideas?

Thank you.

From the following link (How to programmatically close previously opened PDF-files in Adobe Reader) it appears that the SendInput() API function with CTRL-F4 should work.

Edit: Does pressing Ctrl-F4 close the document on the computer?

In the actual Adobe Reader, CTRL+F4 as well as CTRL+W will close the document. In my application, it appears to close the Reader object.

I ended up using two OLEContainers. One is used to display PDF files and the other is always empty. I switch them out on my window as needed.

1 Like