How to put printer data into a response for a web service integration Follow

Avatar
Samantha Petro

Question

The %Response% variable includes no information when a print fails. How can I get more information about printer data in the response?

Answer

There are several variables available for this to work:

The response action offers us two variables that gather information about the printer's job and status. These two variables will offer us valid and usable information when the job succeeds and the variable name when the job fails

print_job_status.png

The third variable is an integration-based variable which will only show information when an integration failed:

print_job_status2.png

Crafting the response

In the response action in your integration, you'll need to create your own response. For this, I've used plain text for simplicity's sake:

print_job_status3.png

Embedded response template:

Print Job Status = %PrintJobStatus%
Print Job Messages = %PrintJobMessages%
Last error message = %LastErrorMessage%

 

Sample responses

Successful print will show the status as successful and the message will confirm this. The error message is blank so it simply prints the variable name.

Job Status = Success
Print Job Messages = BarTender successfully sent the print job to the spooler.

Job Name: resttest2.btw
Document: resttest2.btw
Printer: Zebra ZT420 (300 dpi)

Last error message = %LastErrorMessage%

 

Failed response example will show the error message but not the print status:

Print Job Status = %PrintJobStatus%
Print Job Messages = %PrintJobMessages%
Last error message = Print job 'resttest2.btw' did not complete due to the following error: BarTender cannot use printer 'fakeprinter' to design, print, or export a template due to a printer setup problem.

A Windows error code was returned: 1801

Error message: The printer name is invalid.


There are several possible reasons:

1) The printer is not turned on or is off line. Try printing a test page from Windows.
2) The printer does not exist on your system or network.
3) Security settings prevent access to the printer.
4) If you use a network for printing, there may be a problem with the network connection or the printer driver.
5) There may not be enough memory available. Try closing files and programs you aren't using.
6) The printer driver is installed incorrectly. Try reinstalling the printer driver.

 

Was this article helpful?

0 out of 0 found this helpful

Please sign in to leave a comment.