Sample Code: Export Preview Image Of Currently Opened Format Document Follow

0
Avatar
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"> 
<Folder>.</Folder>
<FileNameTemplate>Preview_Label%PageNumber%.PNG</FileNameTemplate> 
<ImageFormatType>PNG</ImageFormatType> 
<Colors>btColors24Bit</Colors> 
<DPI>300</DPI> 
<IncludeBorder>true</IncludeBorder>
<IncludeMargins>true</IncludeMargins>
<Overwrite>true</Overwrite> 
</ExportPrintPreviewToImage> 
</Command> 
</XMLScript>

3 comments

0
Avatar
M T
Comment actions Permalink

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?

0
Avatar
Jasper Wen
Moderator
Comment actions Permalink

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.

0
Avatar
M T
Comment actions Permalink

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

Please sign in to leave a comment.