跳至主內容

搜尋

搜尋

Printing Labels Using C#

評論

7 條評論

  • Avatar
    Legacy Poster

    Hi. I'm new in using Bartender. I installed Bartender 10.1. I have a desktop application that can save bartender document and can generate serials. I can now print the serial numbers using this code

     

    btFormat = btApp.Formats.Open(@"" + path, false, "");
    
    for (int c = 0; c < dtDataSource.Rows.Count; c++)
    {
    btFormat.SetNamedSubStringValue(dtDataSource.Rows[c]["datasource_name"].ToString(),
    sn[c]);
    }
    
    btFormat.Print("Printing Serial", true, -1, out btMsgs);
    btFormat.Close(BarTender.BtSaveOptions.btSaveChanges);
     

     

     

    My problem is.. 

     

    The saved bartender document has a condition that it must print 3 labels per row. When I try to print using my code, it only prints one label at a time. Please help me. Thank you

    0
  • Avatar
    Shotaro Ito

    To achieve that, you need to print 3 labels in a print job. As that cannot be done by SetNamedSubStringValue -> print method, 

    you need to connect the bartender document to text database. Try if that works with your printer.

    http://www.seagullscientific.com/label-software/barcode-label-software-training-videos.aspx

     

    You can use Commander to detect text file creation and automatically print specific format.

    http://www.seagullscientific.com/label-software/whitepapers/overview-of-commander-new-201406.pdf

     

    Another option is create text file on the fly. This is code sample to showing create a text database at print time by C#, using .net SDK (same thing is possible in ActiveX too)

    http://forums.seagullscientific.com/index.php?/topic/525-sample-code-create-and-assign-csv-database/?p=1504#entry1504

    0
  • Avatar
    Legacy Poster
    btFormat.PrintSetup.IdenticalCopiesOfLabel = 3;
    
    0
  • Avatar
    Legacy Poster

    Thanks for the feedback and sorry for the late reply.

     

    Mr. Shotaro.. Can you please explain more about this code snippet? What is the format for the temporary text file? And does the header line means the datasource names? 

     

    // Prepare data (you can be more creative.)
    string buf = "";
    buf += "\"FNAME\",\"LNAME\",\"DOB\"\r\n"; // header
    buf += "\"Steven\",\"Jobs\",\"1955/02/24\"\r\n"; //record 1
    buf += "\"Stephen\",\"Wozniak\",\"1950/08/11\"\r\n";
    buf += "\"John\",\"Sculley\",\"1939/04/06\"\r\n";
    buf += "\"Gilbert\",\"Amerio\",\"1943/03/01\"\r\n";

     

     

    Thank you!  :) 

    0
  • Avatar
    Legacy Poster

    Hi. I already solved the problem about the temporary file. But I'm having problems with this line of code

     

    Seagull.BarTender.Print.Database.TextFile tf = new Seagull.BarTender.Print.Database.TextFile(btFormat.DatabaseConnections[0].Name);

     

    It says that the index was out of range. Do I need to set something in the bartender format? In my bartender format there is no database connection because it will be set dynamically.Thanks in advance.

    0
  • Avatar
    Legacy Poster

    btFormat.PrintSetup.IdenticalCopiesOfLabel = 3;
    

    Hi, thanks for the feedback but what I need to do is print 3 different serials in one job. :)

    0
  • Avatar
    Shotaro Ito

    Hi Anaechizen,

    On the btw file, you need to create a dummy database connection to a text database, such as

    "FNAME","LNAME","DOB"
    "John","Doe","1999/01/01" 

    Then on the label design's text and barcode, you can use database field to link with the fields.

    the sample code replaces database with the temp file.

     

    Besides, if you're using BarTender's serialization (such as 001 > 002 > 003), which can be specified in Datasource's transform > Serialization.

    Once serialization has enabled, you can specify number of serialized copy from code by 

    btFormat.PrintSetup.NumberSerializedLabels = 3; 
    0

登入寫評論。