Error compiling C# example under .NET Framework 4.0

PDF-XChange Drivers API (only) V4/V5
This Forum is for the use of Software Developers requiring help and assistance for Tracker Software's PDF-XChange Printer Drivers SDK (only) - VERSION 4 & 5 - Please use the PDF-Tools SDK Forum for Library DLL assistance.

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

Post Reply
comsa_se
User
Posts: 2
Joined: Thu Dec 10, 2015 8:32 am

Error compiling C# example under .NET Framework 4.0

Post by comsa_se »

Hello,

I'm currently evaluating your Driver API SDK V5 for creating PDF output from our ECAD application.
I have some problems compiling and running your C# example "PDFdriverAPI" in following environment:

- Windows 7 Pro
- Microsoft Visual Studio 2015 Express 2015 for Windows Desktop
- .NET Framework 4.0

Problem 1: Compiler error with framework 4.0:

At line 52: PDFPrinter = (PXCComLib5.CPXCPrinter)prnFactory.get_Printer("", "Simple PDF-XChange 2012", "<REG CODE>", "<DEV CODE>");
error CS0656: Missing compiler required member "Microsoft.CSharp.RuntimeBinder.Binder.Convert"

This compiler error is not raised under .NET 3.5 or below. But our application requires .NET 4.0.
Is this a known problem and if so can an update be expected in the near future?

Problem 2: "System.BadImageFormatException" with "Interop.PXCComLib5" when starting the app

When using a COM reference to "PDF-XChange Printer 2012 Type Library" in the project (as your example does) the generated Interop assembly "Interop.PXCComLib5.dll" has a size of 18 KB in contrast to 28 KB of your version of the same file which is delivered with your installed example. If I replace the COM reference with a direct assembly reference to your delivered version of "Interop.PXCComLib5.dll" the demo application runs fine under .NET 3.5 or below. (I yust copied "Interop.PXCComLib5.dll" into my bin\Debug folder with no additional files).

Do you have any idea why the COM reference creates this strange behaviour?

Thank you in advance,
Siegfried Eineder
COMSA GmbH
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Error compiling C# example under .NET Framework 4.0

Post by Sasha - Tracker Dev Team »

Hello comsa_se,

As for the problem 1, try this code:

Code: Select all

PXCComLib5.CPXCPrinter PDFPrinter = prnFactory.get_Printer("", "Simple PDF-XChange 2012", "<REG CODE>", "<DEV CODE>") as PXCComLib5.CPXCPrinter;
As for the second problem - we are investigating it and will give you an answer shortly.

HTH
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
User avatar
Roman - Tracker Supp
Site Admin
Posts: 303
Joined: Sun Nov 21, 2004 3:19 pm

Re: Error compiling C# example under .NET Framework 4.0

Post by Roman - Tracker Supp »

Hello comsa_se,

As to the problem 2, please make sure it is not a deployment error.

Check if both the target assemblies (PDFdriverAPI.exe and Interop.PXCComLib5.dll) are compatible by "bitness".

You can verify this with CorFlags utility from your .Net framework SDK.
Both
CorFlags.exe PDFdriverAPI.exe
and
CorFlags.exe Interop.PXCComLib5.dll

should show the same CorFlags value.
comsa_se
User
Posts: 2
Joined: Thu Dec 10, 2015 8:32 am

Re: Error compiling C# example under .NET Framework 4.0

Post by comsa_se »

Hello Sasha and Roman,

your hints perfectly solved my problems - thank you!
The demo program now works as expected and I'm starting to include PDF printing code into my applicationn.

Best regards,
Siegfried
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Error compiling C# example under .NET Framework 4.0

Post by Sasha - Tracker Dev Team »

Glad to hear that :wink:
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply