I have a wolfram script file (.wl) that processes a csv file and generates a PDF output. I have written a PowerShell Script which checks for new input data files and runs the wolfram script file over them using the following command line:

wolfram -script my_script_file.wl

This works fine when the process is run by a logged in user. When it is run on a server executed by a Windows Scheduled Task, I encounter problems exporting the pdf. The following error appears:

Export::fmterr: Invalid PDF format.

I've tried to research this issue. It seems that the part of Mathematica that generates the PDF export isn't available when run using a service account in a Windows Scheduled task.

Is there any way to get around this? Has anyone encountered a similar issue? Would using one of the other exe's to launch the script help? wolframscript.exe, MathKernel.exe, etc?

Thanks for your time and assistance!

  • $\begingroup$ I haven't tried this... But you probably would need to leave a user logged into the server, with the task set to use that user, and make sure "Run only when the user is logged on" is checked. $\endgroup$ – ihojnicki Aug 10 '17 at 15:56
  • $\begingroup$ I have a feeling that would work, but unfortunately I don't have enough control over the server to ensure that a specific user account is always logged in. $\endgroup$ – Paul Warren Aug 10 '17 at 16:02
  • 1
    $\begingroup$ Hopefully at some point that will no longer be a requirement... But I cannot make any promises right now. $\endgroup$ – ihojnicki Aug 10 '17 at 16:22
  • $\begingroup$ the usual cure for that is to wrap UsingFrontEnd around the code that needs frontend functionality. I don't know whether that would work in your case, though. But I think it would certainly be worth trying... $\endgroup$ – Albert Retey Aug 10 '17 at 19:46
  • $\begingroup$ Thanks for the suggestion. I'll give it a try and post back here what happens. $\endgroup$ – Paul Warren Aug 11 '17 at 12:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.