Open topic with navigation
Exporting a Label to an Image
You can export a label to an image file by using the <ExportPrintPreviewToImage> tag and the use the image files to do the following:
Create an image that can be stored, transported, and reprinted.
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 they are printed.
The following example shows the <ExportPrintPreviewToImage> tag. This sample code creates a 24-bit color JPG image file that has a resolution of 300 dpi. Each image includes a border and displays the correct page margins. Because the ReturnImageInResponse attribute is set to true, the response that is returned when this command runs includes a copy of the exported images 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">
Each time that 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 exports a copy of the image that can be viewed in BarTender History Explorer. If the ReturnImageInResponse attribute is set to true, the XML response contains a copy of the image in Base64 format that can be saved and viewed in BarTender History Explorer.
The exported image files and the Base64 format response might be very large. Make sure to reserve sufficient storage space.