Batch printing using REST
I have a customer that is an industrial print shop. They want me to use my custom software to manage their print jobs (using bartender). is it possible to use the REST api to do a batch POST so that we print out a bunch of labels in one batch by specifying the variables for each label?
I confirmed that this POST works:
POST http://localhost:5159/api/actions HTTP/1.1Content-Type: application/jsonAuthorization: Basic XXXXXXXX{"PrintBTWAction":{"Document": "c:\\users\\jonat\\downloads\\test.btw","Printer": "Avery ADTP1EF (300 dpi) - MPCL"}}
But I want to specify the variable names for each label. Something like this but this obviously isn't the right format below.
POST http://localhost:5159/Bartender/api/actions HTTP/1.1
Content-Type: application/json
Authorization: Basic XXXXXXX
{
"Format": "c:\\users\\jonat\\downloads\\test.btw",
"Printer": "Avery ADTP1EF (300 dpi) - MPCL",
"Quantity": 1,
"Records": [
{ "Epc": "E2000017221101101890D435", "STYLE": "12345", "COLOR": "Item 1" },
{ "Epc": "E2000017221101101890D436", "STYLE": "67890", "COLOR": "Item 2" },
{ "Epc": "E2000017221101101890D437", "STYLE": "54321", "COLOR": "Item 3" }
]
}
Where the variable names are the object names in the BTW file. Is this even possible? I want to do a single batch with multiple prints because when I tested it using the .Net SDK one label at a time it would print blank labels between each label print.
Edit: I tested out the BTXML format and although I can send multiple commands out at the same time, they seem to be send to the printer as individual jobs. Is there a way to tell the printer to send several prints out as one job? My BTXML looks like this:
<?xml version="1.0" encoding="utf-8"?>
<XMLScript Version="2.0">
<Command Name="PrintJob0">
<Print>
<Format>C:\Users\jonat\OneDrive\Documents\BarTender\Files\testprintbatch.btw</Format>
<PrintSetup>
<Printer>Avery ADTP1EF (300 dpi) - MPCL</Printer>
</PrintSetup>
<NamedSubString Name="lblName">
<Value>fdfd561</Value>
</NamedSubString>
</Print>
</Command>
<Command Name="PrintJob1">
<Print>
<Format>C:\Users\jonat\OneDrive\Documents\BarTender\Files\testprintbatch.btw</Format>
<PrintSetup>
<Printer>Avery ADTP1EF (300 dpi) - MPCL</Printer>
</PrintSetup>
<NamedSubString Name="lblName">
<Value>3ec1848</Value>
</NamedSubString>
</Print>
</Command>
<Command Name="PrintJob2">
<Print>
<Format>C:\Users\jonat\OneDrive\Documents\BarTender\Files\testprintbatch.btw</Format>
<PrintSetup>
<Printer>Avery ADTP1EF (300 dpi) - MPCL</Printer>
</PrintSetup>
<NamedSubString Name="lblName">
<Value>6d1bb27</Value>
</NamedSubString>
</Print>
</Command>
</XMLScript>
-
You can use database overrides, the articel says cloud but works fine on prem too
How to Use Database Overrides in the BarTender Cloud REST API – BarTender Support PortalWorks like a charm, please follow the article to the letter as I didn't and failed
The property "name" is actually the expected data format, "Text" means a CSV data load
Replace with "JSON" if you use this format, please remember to escape your apostrophies in the "VariableValue""DatabaseOverrides": [
{
"Name": "Text",
"Type": "VariableName",
"DataSourceVariableName": "EventData"
}
]0 -
You can use database overrides but that means that the data source with the mappings needs to be defined in the BTW template. If you dont have a data source defined in the template this will not work. I get that this should work with having a data source mapped, but is much easier for a basic user to design their own templates with just using the variable names for the objects in the template. I guess there isn't any way to do this with Bartender. I would have hoped that sending the BTXML file there would be support to send multiple distinct prints per batch but that doesn't seem to be the case unfortunately.
0
Vous devez vous connecter pour laisser un commentaire.
Commentaires
2 commentaires