BadImageFormatException when using pxclib 40

This Forum is for the use of Software Developers requiring help and assistance for Tracker Software's PDF-Tools SDK of Library DLL functions(only) - Please use the PDF-XChange Drivers API SDK Forum for assistance with all PDF Print Driver related topics or PDF-XChange Viewer SDK if appropriate.

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

Post Reply
m.holik
User
Posts: 21
Joined: Tue Dec 20, 2011 5:47 pm

BadImageFormatException when using pxclib 40

Post by m.holik »

I have windows 7 64 bit os. When trying to create a NewDocument using pxclib40 functions, I get the "BadImageFormatException". Reading about this, I gather that it is due to dll being 32 bit version. Can you please tell me where I can get the 64 bit version of pxclib40.dll? Thanks.
User avatar
John - Tracker Supp
Site Admin
Posts: 5219
Joined: Tue Jun 29, 2004 10:34 am
Location: United Kingdom
Contact:

Re: BadImageFormatException when using pxclib 40

Post by John - Tracker Supp »

Hi,

both 32 and 64 bit dll's are provided in the SDK download and all dll's utilised must be one or other (not mixed) - please see the sub/child folder of your installation called; BIN64 for the 64 bit variants


Also - there are dependancies detailed in the manual that will most likely require multiple dll's - not just pxclib40.dll.

HTH
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com
m.holik
User
Posts: 21
Joined: Tue Dec 20, 2011 5:47 pm

Re: BadImageFormatException when using pxclib 40

Post by m.holik »

I copied the following files from the bin64 directory and still get the exception.
1.dscrt40.dll
2.fm40base.dll
3. fm40base.dll
4.fm40tiff.dll
5.ixclib40.dll
6.netlib40.dll
7.pxclib40.dll
8.pxcview.dll
9.xccdx40.dll
10. xcpro40.dll

Is there anything else I am missing?
Thanks for all your help/
User avatar
John - Tracker Supp
Site Admin
Posts: 5219
Joined: Tue Jun 29, 2004 10:34 am
Location: United Kingdom
Contact:

Re: BadImageFormatException when using pxclib 40

Post by John - Tracker Supp »

Please ensure you do not have 'any' duplicate dll's from a previous release that could be conflicting - anywhere on your system.
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com
m.holik
User
Posts: 21
Joined: Tue Dec 20, 2011 5:47 pm

Re: BadImageFormatException when using pxclib 40

Post by m.holik »

Thanks, I checked to see if I have any duplicates, and I do not have any duplicate versions of these dll's in my project.
User avatar
John - Tracker Supp
Site Admin
Posts: 5219
Joined: Tue Jun 29, 2004 10:34 am
Location: United Kingdom
Contact:

Re: BadImageFormatException when using pxclib 40

Post by John - Tracker Supp »

Can you please try and run one of the 'pre-compiled' examples and advise if that functions corretcly - obviously if it does it would suggest there is something wrong with your code and we would need to see a code snippet or small sample app from you.

Thanks
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com
m.holik
User
Posts: 21
Joined: Tue Dec 20, 2011 5:47 pm

Re: BadImageFormatException when using pxclib 40

Post by m.holik »

Thanks for continuing to help me. I tried to run the SDKExamples/C#Examples/PDFXCDemo project and got the same exception.
m.holik
User
Posts: 21
Joined: Tue Dec 20, 2011 5:47 pm

Re: BadImageFormatException when using pxclib 40

Post by m.holik »

I have also tried running the XCPro40Demo ( I downloaded PDF-XChange PRO 5 SDK and ran the XCPro40Demo under SDKExamples\C#Examples\PXCProDemo) When I click on ExtractPages button it brings up the "Extract pages wizard". When I choose an input PDF I get a message box (title "PDF Toolbox") stating "Unable to load DLL 'xcpro40' The specified module could not be found. Note the Exception happens for the following line of code:

int res = XCPro35_Defs.PXCp_Init(out m_pdf, XCPro35_Defs.g_RegKey, XCPro35_Defs.g_DevCode);

If I instead run the CS_PXCProSample.exe demo program under PDF-XChange Pro 5 SDK\Examples\Bin I can extract pages successfully and all is well.

Thanks for your continued help!
Last edited by m.holik on Thu Jul 12, 2012 3:24 pm, edited 1 time in total.
User avatar
John - Tracker Supp
Site Admin
Posts: 5219
Joined: Tue Jun 29, 2004 10:34 am
Location: United Kingdom
Contact:

Re: BadImageFormatException when using pxclib 40

Post by John - Tracker Supp »

Hi,

The cause of the issue detailed would appear to be, when running the examples is that your dll's are not located with the application executable and therefore are not found - whereas when you run them from the 'BIN' folder as the EXE and the DLL's are located in the same folder - all is found ok.

Either copy all he required DLL's into the same folder as your EXE - or into one for the system variable global folders so that no matter where you locate our exe - the dll's are found - the danger of this is that you must remember to update these anytime you download an update from us and replace those located in the global system variable folder (e.g. C:\Windows\System32)

Please advise if this helps.
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com
m.holik
User
Posts: 21
Joined: Tue Dec 20, 2011 5:47 pm

Re: BadImageFormatException when using pxclib 40

Post by m.holik »

After copying the xcpro40.dll into the directory I now receive a different Exception on the same line of code: "An attempt was made to load a program with an incorrect format."
User avatar
John - Tracker Supp
Site Admin
Posts: 5219
Joined: Tue Jun 29, 2004 10:34 am
Location: United Kingdom
Contact:

Re: BadImageFormatException when using pxclib 40

Post by John - Tracker Supp »

Please make sure you are copying 'ALL' DLL's - not just that one (XCPRO40) in isolation.

If you are still having problems - please - zip and send us (by email -: support@pdf-xchange.com);

The EXE, ALL DLL's being used and the file you are trying to work with and include a link in the email body to this forum post for reference and we will take a look.

Also if it is your own project - please include the source code for us to review, and finally advise specifically the version of Windows in use and if it is 32 or 64 bit.

thanks
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com
m.holik
User
Posts: 21
Joined: Tue Dec 20, 2011 5:47 pm

Re: BadImageFormatException when using pxclib 40

Post by m.holik »

Solved the issue by deleting the 64 bit dll's and replacing them with 32 bit dll versions.

Copied the 32 bit version of these dll's in the bin/debug directory and no longer getting the exception.

1.dscrt40.dll
2.fm40base.dll
3. fm40base.dll
4.fm40tiff.dll
5.ixclib40.dll
6.netlib40.dll
7.pxclib40.dll
8.pxcview.dll
9.xccdx40.dll
10. xcpro40.dll

To recap, I use a 64 bit Windows 7 OS and have "Any CPU" in the project settings and run Visual Studio 2010.
User avatar
John - Tracker Supp
Site Admin
Posts: 5219
Joined: Tue Jun 29, 2004 10:34 am
Location: United Kingdom
Contact:

Re: BadImageFormatException when using pxclib 40

Post by John - Tracker Supp »

Many thanks and pleased a solution has been found that works for you.
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com
Post Reply