This is the second time you ask the question of how to print a PDF-document. On the first time you got a suggestion to your solution to save the documents in a folder and then have a program that looks into the folder and if files exist then print them.
If you have not found a program for it then try to google: “automatic printing from folder”
The problem is once again, you cannot control what the server is doing from the client side. The codeunit that executes the above code is not the user that start the code, it is entirely the servicetier. (For that very reason the SHELL command has been omitted).
Running AcroRd32.exe from command-prompt is not the solution as adobe is a gui-application and not a command-line-application.
The issue about the servicetier and the architecture of the instalalition is quite peculiar, due to network issues in the customer. I thought that using a library as PDFSharp will be an option, i’ve read about it in differenter sites.
Sory for my lack of understanding, I’ll find another way to do this
I am sorry if you find me being rude!. It was definately not the intension!
But your problem is related to printing. You said in another question that you want to print a PDF-file. You found what appeared to be a good solution with the start of Adobe PDF and print with the application. Unfortunately the Adobe does not exit the app after your printing (because it is a GUI-application, and not a commandline-application).
The big “problem” is that you (and many others as well) keep on believing that it is the client that does the actual execution of the code - but it is not. Everything is done on the serverside (the NAV servicetier) and therefore you have to think in a much different way, comparing to if you did it in NAV 2009 R2 or below.
I myself have also struggled with this for a while. What we as NAV developers need to learn is that not everything can be fixed using AL-CODE - other solutions has to be found. And that is what I have trying to give you with the goggle suggestion.
No worries Palle, every tip that comes from you is really appreciated, and more for a rookie like me. Every new development or integration is a battle for me, and it wouldn’t work without your help or others in this forum…
I found in google different 3rd party software, that works really fine, but must be licensed for not generating extra pages with their own watermark. I’ve asked a few of them about licensing.
The other option I found is to create a script with powershell, and add it to the task scheduler…
To be fair. Printing a PDF-file was the original intension. This is what the above solution is doing, the drawback is the running Adobe Reader application that needs to be killed. My suggestion was a powershell script or a program that looks for PDF documents in a specific folder.
You are more than welcome to see if you can come up with a solution that prints a PDF-file (That was not generated by NAV) .
It it has to be done from a commandline I would suggest using the free GhostScript
about “I am generating a PDF with this code, using the PDFSharp library” - are you sure that this library does not have method which close connection or similar?