jimevins / glabels-qt

gLabels Label Designer (Qt/C++)
http://glabels.org
GNU General Public License v3.0
326 stars 90 forks source link

Unable to print using gLabels executables via background services (NSSM,Nomad) Windows 10 #96

Open ichetanbhatt opened 4 years ago

ichetanbhatt commented 4 years ago

Greetings, I hope you all are doing well and healthy amidst the pandemic.

We have been trying to trigger gLabels commands via background services such as NSSM and Nomad. Unluckily we are not able to find a decent solution for the same.

We have tried executing the same via Powershell and it is working as expected. When we try to execute the same via the background process, no printing jobs are sent to the printer queue. (Execution level changes to SYSTEM). Since there are no errors thrown via cp.exec(), I believe that we are able to execute the binary properly but not able to send the print request to the printing queue/

We are trying to execute the following cmds from within a nodeJs application using cp.exec(): glabels-batch-qt "${templatePath}" [Contains a merge file] glabels-qt "${templatePath}" glabels-batch-qt "${printJobObj.templatePath}" -p "${printerName}" -D var1="TEST"

It would be really helpful if someone can propose a solution or a feasible workaround here for the same.

Thank You

riturajborpujari commented 3 years ago

Facing same problem.

I think the problem is with Windows Services rather than gLabels itself. Windows services can not start applications which have GUI, they can only run other scripts / CLI, because of Session 0 Isolation read about it here

There seems to be a way around, using CreateProcessAsUser Windows API but still figuring that out.