How to Read PDF Files Using ActiveX in Qt

To be able read PDF files in your Qt applications you can use any 3rd party libraries but my choice is to use Adobe Acrobat Reader ActiveX in a QAxWidget object. The approach is quite simple as long as you have Acrobat Reader ActiveX installed on your computer.

First you have to create an ActiveX object for Adobe PDF Reader in your MainWindow. That is done using this line:

pdf->setControl("Adobe PDF Reader")

Then you can dynamically call the ActiveX method for loading a PDF file. Here it is:

pdf->dynamicCall("LoadFile(QString)", "some PDF file.PDF");

Note that you have to add axcontainer module to your project or else you can’t use ActiveX objects.

Finally, you can download the example project below which is basically a simple PDF Reader application written using Qt/C++.

Download Qt PDF Reader ActiveX
Qt PDF Reader ActiveX Project Source Code

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.