1. Ramón San Félix Ramón
  2. PowerBuilder
  3. Tuesday, 29 November 2022 12:01 PM UTC

Can anyone with experience with iText7 help me...
I have created a console app to sign pdf which works ok.
When I create a class library project to consume with PowerBuilder and I get the following error:

The type initializer for 'iText.IO.Util.ResourceUtil' threw an exception.

Ramón San Félix Ramón Accepted Answer Pending Moderation
  1. Wednesday, 30 November 2022 16:21 PM UTC
  2. PowerBuilder
  3. # 1

I have updated the example.

Now you can compare the usage of the Dll with NetDllImporter which gives the exception.

The console application executed from PowerBuilder that consumes the same library does work...

Attached test case with PowerBuilder and Snapdevelop project.

Attachments (1)
Comment
  1. Ramón San Félix Ramón
  2. Thursday, 1 December 2022 08:58 AM UTC
If you run the project in SnapDevelop that exception is thrown, but if you click continue it ends without problems. When compiling the app, it can be executed if that exception is thrown.

In the PowerBuilder example I posted (the updated one) you can run the app without problems using Roland Smith's runandwait object.

However, if you try to import the generated dll, the exception that I mentioned at the beginning of this thread is thrown.

As a curiosity, the exception you mention, if you test the project in Visual Studio 2022 instead of SnapDevelo 2022, it doesn't jump.
  1. Helpful
  1. Andreas Mykonios
  2. Thursday, 1 December 2022 10:33 AM UTC
I know. I also tested in VS and it worked fine. This is strange because compilation should be identical as SD uses .net core sdk... I wonder if for some reason this dll needs to have it's dependencies aside while called by PB.

Andreas.
  1. Helpful
  1. Ramón San Félix Ramón
  2. Thursday, 1 December 2022 11:04 AM UTC
I have tried to copy all the content that I had in the iText7 folder in the same directory of the PowerBuilder app and I have modified the code of the example to make it work like this and I have obtained the same result. With the console app it works ok and with the imported library it throws the exception.

Regards,

Ramón.
  1. Helpful
There are no comments made yet.
Ramón San Félix Ramón Accepted Answer Pending Moderation
  1. Tuesday, 29 November 2022 15:38 PM UTC
  2. PowerBuilder
  3. # 2
I use PowerBuilder 2022 build 1892. I have created the NetCore 3.1 class library project with SnapDevelop2022.
I attach compressed example.
In the root directory of the application there is a shortcut to the console app that will run a successful signature test.
Then if you try to do the same with PowerBuilder the exception is thrown.
Attachments (1)
Comment
There are no comments made yet.
Andreas Mykonios Accepted Answer Pending Moderation
  1. Tuesday, 29 November 2022 13:03 PM UTC
  2. PowerBuilder
  3. # 3

Hi.

You don't provide enough information. Tell us:

  • PB version.
  • .net you try to use.
  • Is it a com visible class or you try to work with .NET DLL Importer?
  • At what point you get that error?
  • Give as the prototype of the method PB should call.

Andreas.

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.