Open lazna opened 2 years ago
Not sure if the WebKit print function has a return value to indicate failure but the code currently does not return a failure if it somehow failed to print. It will return an error if the URL fails, but not if printing failed.
Most print routines usually don’t fail as it gets spooled to the print queue and if the printer is not working it is stuck in there until you fix it. So the app doing the printing assumes it all works once it gets spooled.
OK, but what about the program itself? If wrong (insuficient) parameter provided for example? Does it only print error message or set exitcode too? Need distinguis between situations:
"data was successfully sent to printer\queue"
and
"any problem occurs"
Yes, starting here you can see the error handling. Would not be hard to update it to add more error handling if you needed more fine grained details. I just am not sure if you can tell if the printing actually failed at all.
https://github.com/kendallb/PrintHtml/blob/master/main.cpp#L103
Unable to read C code, unfortunatelly :-/
Just found, when there is a typo in path to HTML file to be printed, GUI message "Fatal error: HTML page failed to load" is displayed. In console programs, opening GUI boxes should be generaly avoided. Print ERRMSG to STDERR and set errorlevel instead, please
Unfortunately this program is not a console program, as it needs access to Windows UI components in order to print.
thanks. This is a very important information and should be mented in the beginning of documentation. The list of switches in documentation look like console program and could mislead people.
Is there a chance to run it by psexec by -i or -x switches?
-i Run the program so that it interacts with the desktop of the specified session on the remote system. If no session is specified the process runs in the console session. -x Display the UI on the Winlogon secure desktop (local system only).
cant test it now
Does this prohgram provide any exitcode (errorlevel) if sending to printer (or printing itself) failed?
Found nothing in documentaion