Please enable JavaScript to view this site.

TIFF Image Printer

Description

Uses the Windows shell verb "printto" to print the file. This only works with files that have known associations, meaning there is an installed application already on the computer that knows how to open and print the file.

Not all applications support the "printto" verb. As a general rule, if you can drag and drop the file onto a printer icon, or if there is a Print option in the context menu that appears when you right-click the file, you can use the shell to print it. Optionally, you can have ShellPrintTo default to the ShellPrint command in the case where the printto verb fails.

Syntax

expression.ShellPrintTo(FullPathToFile, WaitMode, WaitModeTimeout, ForceHiddenWnd,

                             ShellProcessTimout, ForceAppClose, UseShellPrintOnFail)

where expression is an IPNPrintSession 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 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 FullPathToFile

Fully-qualified path to the file to be printed.

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, depending on the value chosen for WaitMode above.

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 have this method close the program manually.

Boolean UseShellPrintOnFail

If the shell print verb "printto" fails, automatically call ShellPrint.

Remarks

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 PrintUsingCommand