Printing Multiple Labels On The Same Sheet
In process of developing a C# assembly to automate the printing of labels. A issue that that we are having is printing multiple labels on the same sheet. Each label will have unique information and will not be in any order. We are currently using COM to communicate with bartender and cannot use .NET.
At the moment the code is a simple for loop but will only print one label per sheet as instructed from the "btFormat.Print" what I think I'm missing is something along the lines of a "btFormat.Queue" for example and then "btFormat.Print".
Any help would be much obliged.
Thanks,
James
try
{
BarTender.ApplicationClass btApp;
BarTender.Format btFormat;
BarTender.Messages btMsgs;
btApp = new BarTender.ApplicationClass();
btFormat = btApp.Formats.Open("D:\\label.btw", false, "");
//Populates the information into the visible datagridview
int i = 0;
foreach (DataGridViewRow rows in dataGridView1.Rows)
{
try
{
//Pulls Data from DataGridView
btFormat.SetNamedSubStringValue("bt_AssyNum", dataGridView1[5, i].Value.ToString());
}
catch (Exception exc)
{
MessageBox.Show("Error *: /n" + exc.Message);
}
btFormat.Print("Bag Labels " + i, false, 1, out btMsgs);
i++;
}
// Heads up... this does not appaer to be closing Bartender
btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);
Debug.WriteLine("Printing Label " + i);
}
catch (Exception exc)
{
MessageBox.Show("Error 100*: /n" + exc.Message);
}
-
Shotaro Ito
★ BarTender Hero ★
Hi James,
To print multiple labels with different data on a page, you need to give data as rows of database.
Create a BarTender document which connect to CSV database, then give data at print time.
http://www.seagullscientific.com/label-software/training-video-(reading-data-from-database).aspx
Sample below is done by .net SDK, however the same approach can be used from ActiveX too.
http://forums.seagullscientific.com/index.php?/topic/525-sample-code-create-and-assign-csv-database/
0
请先登录再写评论。
评论
1 条评论