Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

pdfsharp dll not working in batch mode

(0) ShareShare
ReportReport
Posted on by

I have an issue with pdfsharp dll. I was able to use the dll in on a local dev instance to successfully merge two pdf files using x++ code. When I promote this dll to TEST in a different instance it fails to run in batch mode. It runs fine in interactive mode.

My server configuration

Local dev instance- AX 2012 R3 all in one  box where we have the SQL and SSRS on the same box.
TEST instance = AX 2012 2 AOS Server. 1 dedicated batch server and 1 ssrs server.

The process worked correctly on both AOS servers when running in interactive mode. It fails only in batch mode. Something that is not reflecting in CLR.

I have added the required dll files to both server\bin and client\ bind folder.

I have also done multiple compile and CIL generations and nothing seems to help.

Any suggestions on how to resolve this issue in batch.

*This post is locked for comments

  • Verified answer
    RE: pdfsharp dll not working in batch mode

    Thank you for the responses. I was able to resolve the issue by adding to GAC following this thread. 

    community.dynamics.com/.../173842

  • Martin Dráb Profile Picture
    Martin Dráb 231,409 Most Valuable Professional on at
    RE: pdfsharp dll not working in batch mode

    If I understand you correctly, you executed code on server and it works in X++ but not when switched to CIL (without using if so).

    If so, it rules you the options that the library can't be loaded on server (because it can't be found or because it can't be loaded to an 64-bit process). It also proves that the problem isn't related to batch; it's about CIL. This kind of problem isolation is the why I asked my questions.

    Just to be sure, how exactly did you forced code run in X++ on server and then in CIL?

    The fact that an assembly can be load to AOS when using X++ runtime but it doesn't work in the same process when using CIL is highly unusual. I can't think of any realistic reason. Please use the Assembly Binding Log Viewer (on server) to collect more information about why it can't be loaded.

  • Suggested answer
    Vilmos Kintera Profile Picture
    Vilmos Kintera 46,149 on at
    RE: pdfsharp dll not working in batch mode

    It is very likely that your DLL has been compiled to run on x86 architecture only, and does not support 64-bit execution, which is your AX AOS instance. It is simply not going to work.

    See one solution here, you must create a separate service which you could call from your AX AOS, and would do your PDF processing in 32 bit:

    community.dynamics.com/.../82783

  • RE: pdfsharp dll not working in batch mode

    I used X++ runtime on the AOS and I confirmed that I have the dll in both server and client Bin directories.  This works fine running to screen.

    When running in CLR I get the error.  I have done full compile and CIL multiple times.

  • Martin Dráb Profile Picture
    Martin Dráb 231,409 Most Valuable Professional on at
    RE: pdfsharp dll not working in batch mode

    "The process works in interactive mode in interactive mode" didn't give me any new information. Please tell us whether you run your code on client or AOS and whether you use the X++ runtime or CLR (the runtime for CIL).

    If you run it on client, you're testing a completely different thing. The library or may not be installed on AOS at all.

  • RE: pdfsharp dll not working in batch mode

    Thank you for responding. The process works in interactive mode in interactive mode. It fails only in batch mode. 

    The error I get is as following error in batch mode. 

    Assembly containing type PdfSharp, Version=1.31.1789.0, Culture=neutral, PublicKeyToken=f94615aa0424f9eb::::PdfSharp.Pdf.PdfDocument is not referenced.

  • Martin Dráb Profile Picture
    Martin Dráb 231,409 Most Valuable Professional on at
    RE: pdfsharp dll not working in batch mode

    Please describe the problem - neither "not working" nor "it fails to run" is very detailed.

    Also, please confirm whether "The process worked correctly on both AOS servers when running in interactive mode" means that you ran the code on server.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,409 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans