Problems using PDF-XChange Editor SDK with C++ (Qt/MFC)

PDF-XChange Editor SDK for Developers

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
SoftwareDev
User
Posts: 4
Joined: Thu Apr 18, 2019 7:22 am

Problems using PDF-XChange Editor SDK with C++ (Qt/MFC)

Post by SoftwareDev »

Hi everyone,

our company is currently evaluating the PDF-XChange Editor SDK. We would like to use it together with Qt/C++. Unfortunately, we have encoutered some problems:

I have created a demo project with Qt, C# and MFC. Only the C# project works.

1. For the use with Qt C++, I created a header file with wrapper classes from the typelib (PDFXEditCore.x64.tlb). Qt offers a special tool called dumpcpp to do so. The generated header file as is did not work because some structs were missing. I also tried it with a MFC project in Visual Studio, to make sure that the error has not been not caused by dumpcpp . Same there, the header file is not compileable due to missing structs. Thus, I assume that the typelib is incomplete. However, I have looked up the structs from the documentation and fixed the errors in the header files.

2. My project contains a simple GUI with a PDF-XChange Editor ActiveX control and two buttons. Basically, I am trying to call the functions OpenDocFromPath(BSTR) and OpenDocumentFromFile(LPWSTR, IPXC_DocAuthCallback*).
My application raises the following errors:

Code: Select all

QAxBase: Error calling IDispatch member OpenDocFromPath: Type mismatch in
parameter 0
QAxBase: Error calling IDispatch member OpenDocumentFromFile: Member not found
I talked to the official Qt support team and they said:

The first error indicates that the parameter being passed to OpenDocFromPath either is not of type BSTR or it does expect a type different from BSTR. The second one is really odd because the OpenDocumentFromFile function is not even found.

We believe the problem is in the control since we are doing what is expected with it reporting as a BSTR, but the control is the one claiming that the parameters do not match so something is not right there.

I tried to compare it to my MFC project but I have got two other problems there:
  • On one machine, I have got Visual Studio 2015 installed. I can build and run the program. When I run it, it shows a MessageBox saying, that it could not open the library.
  • On another machine, I have got Visual Studio 2017 installed. There I cannot even drag the ActiveX control on the form. When I try to do so, the whole IDE crashes. After that, I copied the Visual Studio 2015 project from the other machine and opened it. Then it shows a message box saying: "Debug Assertion Failed! Program: C:\Windows\SYSTEM32\mfc140ud.dll File: d:\agent\_work\3\s\src\vctools\vc7libs\ship\atlmfc\src\mfc\occont.cpp Line 925".
I hope you will find a solution so that we can use the PDF-XChange SDK in C++ with Qt. Many thanks in advance.

Regards
Attachments
qt_project.7z
(336.16 KiB) Downloaded 66 times
MFCApplication.zip
(159.4 KiB) Downloaded 73 times
project_dotnet.zip
(639.93 KiB) Downloaded 69 times
Last edited by SoftwareDev on Thu Apr 18, 2019 12:11 pm, edited 2 times in total.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Problems using PDF-XChange Editor SDK with C++ (Qt/MFC)

Post by Sasha - Tracker Dev Team »

Hello SoftwareDev,

Can you send us your project on MFC for investigation?

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
SoftwareDev
User
Posts: 4
Joined: Thu Apr 18, 2019 7:22 am

Re: Problems using PDF-XChange Editor SDK with C++ (Qt/MFC)

Post by SoftwareDev »

Sasha - Tracker Dev Team wrote: Thu Apr 18, 2019 11:25 am Can you send us your project on MFC for investigation?
Seems like something went wrong with my attachments. Sorry for that. Now, you can find them under my first post.
SoftwareDev
User
Posts: 4
Joined: Thu Apr 18, 2019 7:22 am

Re: Problems using PDF-XChange Editor SDK with C++ (Qt/MFC)

Post by SoftwareDev »

SoftwareDev wrote: Thu Apr 18, 2019 9:09 am
  • On one machine, I have got Visual Studio 2015 installed. I can build and run the program. When I run it, it shows a MessageBox saying, that it could not open the library.
  • On another machine, I have got Visual Studio 2017 installed. There I cannot even drag the ActiveX control on the form. When I try to do so, the whole IDE crashes. After that, I copied the Visual Studio 2015 project from the other machine and opened it. Then it shows a message box saying: "Debug Assertion Failed! Program: C:\Windows\SYSTEM32\mfc140ud.dll File: d:\agent\_work\3\s\src\vctools\vc7libs\ship\atlmfc\src\mfc\occont.cpp Line 925".
I found out that I had installed an old version (6.0) on the VS2015 machine. After installing the latest Editor SDK, the IDE crashes like on the other machine.
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Problems using PDF-XChange Editor SDK with C++ (Qt/MFC)

Post by Sasha - Tracker Dev Team »

Hello SoftwareDev,

We've fixed the MFC crash - you can download the latest release 331 and try it for yourself.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
SoftwareDev
User
Posts: 4
Joined: Thu Apr 18, 2019 7:22 am

Re: Problems using PDF-XChange Editor SDK with C++ (Qt/MFC)

Post by SoftwareDev »

Sasha - Tracker Dev Team wrote: Tue Apr 23, 2019 6:57 am Hello SoftwareDev,

We've fixed the MFC crash - you can download the latest release 331 and try it for yourself.

Cheers,
Alex
Hi Alex,

thank you very much. The MFC project works now.

Code: Select all

QAxBase: Error calling IDispatch member OpenDocFromPath: Type mismatch in
parameter 0
Do you have any clue why the SDK does not work with my Qt project?
Is the first parameter of the OpenDocFromPath() function really a BSTR?
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Problems using PDF-XChange Editor SDK with C++ (Qt/MFC)

Post by Sasha - Tracker Dev Team »

Hello SoftwareDev,

Try using LPWSTR or LPCWSTR and see if it helps.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply