Amending Picture In Xml Script
hi
i'm trying to use an xml script. i can amend the namedsubstrings but can't find a way to change the pictures that are displayed.
vb.net code:
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim btApp As New BarTender.Application
Dim btMessages As BarTender.Messages = Nothing
btApp.XMLScript("E:\BarTenderXMLScripts\Print_Dispensed_Label.xml", BarTender.BtXMLSourceType.btXMLScriptFile, btMessages)
Dim msg As BarTender.Message
For Each msg In btMessages
MessageBox.Show(msg.Message)
Next msg
btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)
End Sub
xml script:
<?xml version="1.0" encoding="utf-8"?>
<XMLScript Version="2.0">
<Command Name="Job1">
<Print>
<Format>C:\Documents and Settings\johnl\My Documents\BarTender\Labels\Label7.btw</Format>
<NamedSubString Name="OrderCode">
<Value>12341234</Value>
</NamedSubString>
<NamedSubString Name="MaterialCode">
<Value>M123123</Value>
</NamedSubString>
<!-- etc., etc., need to set picture path/file here -->
</Print>
</Command>
</XMLScript>
is this supported?
johnl
i'm trying to use an xml script. i can amend the namedsubstrings but can't find a way to change the pictures that are displayed.
vb.net code:
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim btApp As New BarTender.Application
Dim btMessages As BarTender.Messages = Nothing
btApp.XMLScript("E:\BarTenderXMLScripts\Print_Dispensed_Label.xml", BarTender.BtXMLSourceType.btXMLScriptFile, btMessages)
Dim msg As BarTender.Message
For Each msg In btMessages
MessageBox.Show(msg.Message)
Next msg
btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)
End Sub
xml script:
<?xml version="1.0" encoding="utf-8"?>
<XMLScript Version="2.0">
<Command Name="Job1">
<Print>
<Format>C:\Documents and Settings\johnl\My Documents\BarTender\Labels\Label7.btw</Format>
<NamedSubString Name="OrderCode">
<Value>12341234</Value>
</NamedSubString>
<NamedSubString Name="MaterialCode">
<Value>M123123</Value>
</NamedSubString>
<!-- etc., etc., need to set picture path/file here -->
</Print>
</Command>
</XMLScript>
is this supported?
johnl
0
-
In the label format set-up the picture object to be data sourced by a linked file. Specify the path for where the picture files are located. Under the data source tab use "Screen Data" data source and give the sub-string a unique share name.
Then in your XML use the <NamedSubString> tag to set the name of the sub-sting to the name of the picture file you want the object to be. Example: Picture1.png0 -
An alternate option is to data source the picture with base64 data. Share the screen data sub-string as before and then in your XML set the sub-string value with base64 encoded picture data. There are many tools available to encode pictures into base64, some like the below can be found on the web.
http://www.motobit.com/util/base64-decoder-encoder.asp0 -
Legacy Poster
★ BarTender Hero ★
hi
used your first suggestion
<?xml version="1.0" encoding="utf-8"?>
<XMLScript Version="2.0">
<Command Name="Job1">
<Print>
<Format>C:\Documents and Settings\johnl\My Documents\BarTender\Labels\Label7.btw</Format>
<NamedSubString Name="OrderCode">
<Value>12341234</Value>
</NamedSubString>
<NamedSubString Name="MaterialCode">
<Value>M123123</Value>
</NamedSubString>
<NamedSubString Name="HS1">
<Value>Cosh1.jpg</Value>
</NamedSubString>
<NamedSubString Name="HS2">
<Value>Cosh2.jpg</Value>
</NamedSubString>
<NamedSubString Name="HS3">
<Value>Cosh3.jpg</Value>
</NamedSubString>
</Print>
</Command>
works a treat thank you
johnl0
Please sign in to leave a comment.
Comments
3 comments