Sample Code: Export Preview Image Of Currently Opened Format Document 追蹤

Shotaro Ito

Hi There,
There's some occasion I need to quick check ExportPrintPreviewToImage tag recently, so I create a sample for this.

To use, open any label format by BarTender (Enterprise Automation Edition or Valid trial), then File > Run BTXML Script. Images will be saved the same folder as btw file.


preview export.btxml (rename from .txt to .btxml)

<?xml version="1.0" encoding="utf-8"?> 
<!-- This script exports current Label format document's print preview to splecified folder.
Execute from File > Run xml script.
(XML Script can be used from BarTender Enterprise Automation Edition only)
in <ImageFormatType> tag, specify file type (JPG/PNG/GIF/BMP etc)
in <Folder> tag, export folder (relative path can be specified - "." means the same as same folder as format)
in <FileNameTemplate> tag, specify file name (%PageNumber% is page number)
in <DPI> tag, export resolution
in <IncludeBorder> tag, specify label border
in <IncludeMargins> tag, specify margins
<XMLScript Version="2.0" Name="Job1" ID="123"> 
<Command Name="Job1"> 
<ExportPrintPreviewToImage ReturnImageInResponse="false"> 

3 意見

評論操作 永久連結

I used the btxml script to export image as .eps but the output file size is greater than 3 MB compare to ~200 KB when going through File - Export Image step. Any thoughts of such a hugh difference?

Jasper Wen
評論操作 永久連結

One thing to keep in mind the <ExportPrintPreviewToImage> tag exports all printed labels like you would see in the BarTender print preview. If you are specifying to print multiple copies, then it would generate an image per printed page. Doing file->export image in BarTender only exports a single image of the label design and not what is generated at print time or in the print preview.

評論操作 永久連結

There was only 1 label I exported so I have no idea why the <ExportPrintPreviewToImage> creates a huge file.