Running a Windows IIS with PHP FastCGI environment I want to print a full-path pdf file on a network printer.
Running the same command as domain administrator the pdf file prints successful.
As the applicationpool runs as <machinename$> I started sumulating the process without involving the intranet website at all.
I have psexec on my d:\tools directory.
Also sumatrapdf within d:\tools\SumatraPDF.
I start on the Intranetserver from a command box like:
- “D:\Tools>psexec -s cmd”
The “whoami” command shows: - “nt authority\system”
With "set |findstr “USERNAME” it shows: - USERDOMAIN=
- USERNAME=$
** the userdoamin and the username are the same for the SVCHOST -k iissvcs, as w3wp.exe and php-cgi.exe as the Intranet runs
In the dos-box I continue with expanding the PATH to include the SumatraPDF directory:
- set PATH=D:\tools\Sumatrapdf;%PATH%
Before the expansion calling SumatraPDF.exe I get:
- ‘sumatrapdf.exe’ is not recognized as an internal or external command operable program or batch file.
After the PATH adjustment I get no message but I proof it is running via the tasklist command like
- tasklist /v | findstr “Sumatra”
which returns - SumatraPDF.exe 808 Services 0 10,792 K Unknown NT AUTHORITY\SYSTEM 0:00:00 N/A
So I know it is started.
I kill via Taskkill:
- taskkill /PID 808 /F
Which returns: - SUCCESS: The process with PID 808 has been terminated.
The SumatraPDF.exe has not been coming to the Foreground at all.
Running the full command like:
-
SumatraPDF.exe -silent -exit-on-print -print-to \ -print-settings simplex,paper=A4,portrait
it runs but does not print a file and %errorlevel% shows 1. -
tasklist /v | findstr “Sumatra” does not return anything so SumatrPDF.exe existed as the parameters where specified like that, so expected behaviour.
Now running it with -console it shows via the tasklist /v | findstr “Sumatra” and also the sysinternals procexp program shows that SumatraPDF.exe is running with all the specified arguments.
Tasklist /M shows:
SumatraPDF.exe 3984 ntdll.dll, wow64.dll, wow64win.dll,
wow64cpu.dll, umppc12806.dll
As Sumatrapdf does not have a logging file to check I don’t know what is the reason for not printing the pdf file to the network printer and when I run the same steps from a dos-box as a domain adminstrator it does.
The above way I simulated as close as possible the PDF file printing from a PHP based intranet page which also does not print.
Any explanation/ideas?