Using Python, I am trying to create an exe that will print barcode labels. This will interact with BarTender labeling software. I understand this is possible but I am new to Python and not sure how to go about this. I have it in C# but I need to convert to Python. Would this be a simple conversion for someone who knows both languages ;)
// Declare a BarTender application variable
BarTender.Application btApp;
// Declare two BarTender document variables
BarTender.Format btFormat1;
BarTender.Format btFormat2;
// Create a new instance of BarTender
btApp = new BarTender.Application();
// Set the BarTender application visible
btApp.Visible = true;
// Open a BarTender document
btFormat1 = btApp.Formats.Open("c:\\Format1.btw", false, "");
// Open a second BarTender document
btFormat2 = btApp.Formats.Open("c:\\Format2.btw", false, "");
// Set focus to the first opened document
btFormat1.Activate();
// End the BarTender process
btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);
So far I have
import win32.com.client
btApp = win32com.client.Dispatch("BarTender.Application")
btApp.Visible = 1
btFormat = btApp.Formats.Open(r"C:\Users\kmoe\Desktop\Print-Self_Labels.btw", false, "")
The first argument is required and is a string containing the path and file name of the document to open. The second argument is a Boolean: if it is true, the method will close the default blank document called "Document1" that BarTender automatically opens when it starts. It cannot close documents that have any other name. The third argument specifies a printer to use.
However, this only opens the correct label template but does not print to the default printer
More info can be found here
Thanks in advance!