Please enable JavaScript to view this site.

TIFF Image Printer

Description

Specify a custom program to print the files to the IPNPrintSession object's printer.

Syntax

expression.PrintUsingCommand(PathToEXE, Parameters, WaitMode, WaitModeTimeout,

                            SetAsDefaultPrinter, ForceHiddenWnd, ShellProcessTimout,

                            ForceAppClose, CheckExitCode, ValidExitCode)

where expression is an IPNSession object.

Returns Boolean True if the shell executed correctly and the file being printed reached the requested state (spooled, printed or completed) in the time period specified.

The method returns False if:

the printer cannot be set as the system default printer within the timeout period specified by the WaitModeTimeout argument.

the file being printed has not entered the print queue within a set amount of time. This timeout period used is the FirstJobTimeout value passed in the NewPrintSession call when getting the IPNPrintSession object.

the file being printed has not reached the requested state(spooled, printed, completed) within the timeout period specified by WaitModeTimeout

An exception is thrown if the shell call fails. See the Remarks section below for a list of errors.

Parameters

String PathToEXE

Fully-qualified path to the program to use to print the file.

String Parameters

Any parameters needed by the program to print the file.

pnShellAndCommandWaitMode WaitMode

A pnShellAndCommandWaitMode constant to determine the wait mode (spooled, printed, completed) for the file being printed.

Integer WaitModeTimeout

How long, in milliseconds, to wait for the program to print the document and for the print job to be spooled, printed or completed.

Boolean SetAsDefaultPrinter

Pass True if the program requires the printer to be the default printer. The original default printer is restored when the print command is completed.

Boolean ForceHiddenWnd

Pass True to force the program window to be hidden. This will not work on all applications.

Integer ShellProcessTimout

The amount of time, in milliseconds, to wait for the launched program to close by itself. If it has not closed by the end of the timeout period and ForceAppClose is True, the program is passed a close message to request that it close cleanly and again waits the timeout period. If at the end of the second wait the program still has not closed, it it forcibly terminated.

Boolean ForceAppClose

Pass True to force the program to close.

Boolean CheckExitCode

Pass True if the program returns an exit code with a meaningful value.

Integer ValidExitCode

If the program returns an exit code, pass the valid exit code here to have the PrintUsingCommand check the exit code and return accordingly.

Exceptions

If the shell call fails one of the following error message is thrown as an exception:

Error Code

Description

ERROR_FILE_NOT_FOUND

The specified file was not found

ERROR_PATH_NOT_FOUND

The specified path was not found

ERROR_DDE_FAIL

The Dynamic Data Exchange (DDE) transaction failed.

ERROR_NO_ASSOCIATION

There is no application associated with the given file name extension.

ERROR_ACCESS_DENIED

Access to the specified file is denied.

ERROR_DLL_NOT_FOUND

One of the library files necessary to run the application can't be found.

ERROR_CANCELLED

The function prompted the user for additional information, but the user canceled the request.

ERROR_NOT_ENOUGH_MEMORY

There is not enough memory to perform the specified action.

ERROR_SHARING_VIOLATION

A sharing violation occurred.

See Also: ShellPrint ShellPrintTo