Exporting a Label to an Image |
You can export a label to an image file using the <ExportPrintPreviewToImage> tag and use the image files to:
Create an image that can be stored, transported and reprinted as desired.
Create a record that you can use to visually validate the quality of the label.
Create a file that can be called in a custom application to preview labels before printing them.
The following example shows the <ExportPrintPreviewToImage> tag. This example creates a 24 bit color JPG image file with 300 DPI resolution. Each image will include a border and display the correct page margins. Because the ReturnImageInResponse attribute is set to true, the response that will be returned when this command completes will include a copy of the exported image(s) in Base64 format.
If the print job consisted of multiple pages, each page would be saved as a unique image file with a file name that includes the words "Preview Label" and the page number.
<?xml version="1.0" encoding="utf-8"?>
<XMLScript Version="2.0" Name="09232006_103601_Job1" ID="123">
<Command Name="Job1">
<ExportPrintPreviewToImage ReturnImageInResponse="true">
<Format>c:\format1.btw</Format>
<Folder>c:\Images</Folder>
<FileNameTemplate>Preview_Label%PageNumber%.jpg</FileNameTemplate>
<ImageFormatType>JPG</ImageFormatType>
<Colors>btColors24Bit</Colors>
<DPI>300</DPI>
<Overwrite>true</Overwrite>
<IncludeMargins>true</IncludeMargins>
<IncludeBorder>true</IncludeBorder>
<BackgroundColor>16777215</BackgroundColor>
</ExportPrintPreviewToImage>
</Command>
</XMLScript>
Each time an <ExportPrintPreviewToImage> command is passed to BarTender, one or more image files are created in the target folder, and an XML response is generated. If the ReturnImageInResponse attribute is set to false, the command will export a copy of the image that can be viewed in the BarTender History Explorer. If the ReturnImageInResponse attribute is set to true, the XML response will contain a copy of the image in Base64 format that can be saved and viewed in the BarTender History Explorer.
Both the exported image files and the Base64 format response may be very large and care should be taken to reserve storage space.
Related Topics