Using the XML Response |
In some cases, an XML response is created after running the script. An example of this is when you pass BTXML Script to BarTender using ActiveX Automation. An XML response will provide you with valuable information about the print job, the printer used to complete the job, BarTender's settings during the print job, and complete details about the printed items. This response can be integrated with a custom application. An XML response is returned when BTXML script is run using the following methods:
ActiveX Automation
Print Server API
Integration Builder Integration Files
You can use the information contained in the response to:
Troubleshoot problems encountered while processing print jobs.
Record the status of print jobs.
Create a record that you can use to validate the content of documents and individual printed items.
Create a summary of the entire print job.
The default response containing information about the user who sent the BTXML request, the printer used to process the request, the status of the print job and any messages that were created is returned. The following example displays the response returned when no attributes are used or when the ReturnPrintData attribute is set to true and the ReturnSummary and ReturnLabelData attributes are set to false:
<?xml version="1.0" encoding="utf-16"?>
<Response Version="2.0" Name="09232006_103601_Job1" ID="123" AppName="BarTender" AppVersion="9.00" AppVersionId="900" AppVersionMajor="9" AppVersionMinor="00" AppVersionBuild="2345" AppInstancePid="12345" AppInstanceGUID="(5EFC7975-14BC-11CF-9B2B-00AA00573819)">
<User>Administrator</User>
<Server>MyServer</Server>
<Command Name="Job1">
<Print GUID="{C87068F8-4972-41F1-A6E8-724381703764}" JobName="MCIJob" ID="1234" JobLastStatus="Sent" JobCompleted="true">
<JobStatus Completed="true">
<TimeJobStart>02:24:34</TimeJobStart>
<TimeJobQueued>02:24:34</TimeJobQueued>
<TimeJobSent>02:24:34</TimeJobSent>
<LastStatus>Sent</LastStatus>
<Description>Finished sending print job to printer.</Description>
</JobStatus>
<Message ID="1606" GUID="{8A8E8550-C822-4e84-8713-212793DFD6E1}" Severity="Information" Category="Miscellaneous" Response="OK">
<Text>BarTender successfully sent the print job to the spooler.
Job Name: MyJobName
BarTender Document: Document1.btw
Printer: Datamax H-4212 7.1.4 </Text>
</Message>
</Print>
</Command>
</Response>
You can set the response to include additional information by setting the attributes associated with the following commands:
<Print> Command attributes: ReturnPrintData, ReturnSummary, ReturnLabelData, and ReturnChecksum.
<ExportPrintPreviewToImage> Command attribute: ReturnImageInReponse.
The following sections introduce these attributes, and how they affect the response.
The ReturnPrintData attribute displays the summary data and the template information depending upon how the ReturnSummaryData and ReturnLabelData attributes are set. When you set the Print Command's ReturnPrintData attribute to true and do not include any other attribute, the response includes the print job details, a summary of the print job and the individual item information. Setting either the ReturnSummaryData or ReturnLabelData attributes to false will remove their information from the response.
Click Response to view an example of the response returned when the ReturnPrintData attribute is set to true and no other attributes are set or when the ReturnSummary, ReturnLabelData and ReturnChecksum attributes are included and also set to true.
Setting the ReturnSummary attribute of the <Print> Command to true, or not including the attribute at all, returns a response that includes the ReturnPrintData attribute information and a summary of the entire print job. The summary information includes document and printer information, general page and layout information, and how BarTender was configured when it processed the print job. Refer to the <Summary> tag for a detailed description of the various tags. Setting the ReturnSummary attribute of the <Print> Command to false returns a response that does not include a detailed summary of the print job.
Click ReturnSummary to view an example that displays the response returned when the ReturnSummary attribute is set to true and the ReturnLabelData attribute is set to false.
Setting the ReturnLabelData attribute to true or not including the attribute at all, returns a response that includes the print job information described in the ReturnPrintData attribute and a detailed definition that includes page, template, object and data source information, and can be used to validate and reprint the print job. Refer to the <Pages> tag for a detailed description of the various tags. Setting the ReturnLabelData attribute of the <Print> Command to false returns a response that does not include any template data.
Click ReturnLabelData to view an example that displays the response returned when the ReturnLabelData attribute is set to true, but the ReturnSummary attribute is set to false.
To return checksum data in the response you must set the ReturnChecksum attribute to true. When set, the checksum attribute returns checksums that represent various parts of the print job and objects included on the document being printed.
History Explorer and Reprint Console will use these checksum values to verify the content of the documents being reprinted by comparing the checksums of the new document with the old one. If the checksum values match, you can be sure that the document you will print exactly matches the old one. If the checksum values do not match, you will know that the new document has changed in some way. With that knowledge you may choose to print the document with the difference, or you may choose to correct the difference so that the items match again before printing. Refer to the <FormatChecksum> tag for a detailed description of the returned checksum values.
Click ReturnChecksum to view an example that displays the response returned when the ReturnChecksum attribute is set to true.
The ReturnImageInReponse attribute of the <ExportPrintPreviewToImage> Command returns a response that contains an image of the exported template as a string in Base 64 format.
|
A response containing template data in Base 64 format will consume a lot of space. |
Related Topics