跳至主內容

搜尋

搜尋

Converting A Vb6 App (Bartender 7.75)

評論

5 條評論

  • Avatar
    Shotaro Ito

    Sure, the command line options /F /P /D /X are still works in BT10.1 Automation or above.

    Note that bartend.exe 's location is vary in BarTender / windows x86/x64 versions.

     

    From command line options, you can specify number of copy by /C and printer name by /PRN.

    See command line reference in 

    BarTender help > Automating BarTender > Automation with Command Line Interface > Command Line Parameter Reference.

     

    Going .NET SDK is a good option as it provides much more flexibility.

    There's some codes in BarTender help > Automating BarTender > Automation with BarTender .net SDKs > BarTender .net Print SDK > Getting Started.

    Note that starting BarTender (engine.start) and terminating bartender (engine.stop) takes time, so try to keep it open while printing jobs.

     

    Consider using Commander / Commander Script too - this could be similar to command line approach and effective as it keep BarTender open and cache formats.

    Commander script described in example #3 below.

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

     

    Also this troubleshooter is must see..

    http://forums.seagullscientific.com/index.php?/topic/55-commander-troubleshooting/

    0
  • Avatar
    Legacy Poster

    The current application updates a file (containing the data for the btw file).  Can you I pass a file to the engine in a similar manner?

    0
  • Avatar
    Shotaro Ito

    Yes, both Command line and Commander still supports /D="<text database file name>" option to pass data.

    From .net SDK it would be like this.

    (extract from Getting started in help)

    Imports Seagull.BarTender.Print.Database
    
    ' Application Code 
    
    ' ... 
    
    Dim btEngine As New Engine()
    
    ' Start a BarTender print engine 
    
    btEngine.Start()
    
    ' Open a label format 
    
    Dim btFormat As LabelFormatDocument = btEngine.Documents.Open("c:\MyLabel.btw")
    
    ' Set the TextFile database connection file name 
    
    CType(btFormat.DatabaseConnections("TextFileDB"), TextFile).FileName = "c:\NutritionInformationEurope.txt"
    
    ' Print the label format document 
    
    btFormat.Print()
    
    ' Stop the engine 
    
    btEngine.Stop() 
    
    
    0
  • Avatar
    Legacy Poster

    Shotaro

     

    Thanks for your reply. one more question if you don't mind. 

     

    VB.net for some reason does not like the ",TextFile" in the databaseConnect command.  Error is type TextFile is not defined.

     

    I tried inserting

    Dim TextFile as new Seagull.Bartender.Print.Database.TextFile and it did not work.

     

    Here is my subroutine code

     


     

    Public Sub PrintLabels(ByRef LabelTemplate As String, ByRef PrinterName As String, ByRef NbrofCopies As Integer)

     

        Using btEngine As New Engine(True)

     

           ' Start the BarTender print engine.           
              btEngine.Start()  

     

                ' Open a format.

                Dim btFormat As LabelFormatDocument = btEngine.Documents.Open("C:\lblgen.btw", PrinterName)

     

                ' set number of copies

                  btFormat.PrinterSetUp.IdenticalCopiesofLabel = NbrofCopies

     

                   ' Set the TextFile database connection file name 
                  CType(btFormat.DatabaseConnections("TextFileDB"),TextFile).FileName = "c:\LabelText.txt"

     

                 'Print  the format

                btFormat.Print()

     

               'Close the current format without saving

               btFormat.Close(SaveOptions.DoNotSaveChanges)

     

              'Stop bartender engine

              btEngine.Stop

     

         End Using

     

    End Sub

     

    What am I doing incorrectly


     


     


     

    0
  • Avatar
    Shotaro Ito

    Oh... "TextFileDB" is actually the database name of the text database - in default, this is "Text File 1".  you can check / rename that in BarTender's database connection setup.

    Using code below, it will replace primary text database whatever the database name is.

                Dim tf As Seagull.BarTender.Print.Database.TextFile = New Seagull.BarTender.Print.Database.TextFile(btFormat.DatabaseConnections(0).Name)
                tf.FileName = "C:\data.csv"
                btFormat.DatabaseConnections.SetDatabaseConnection(tf)
    
    0

登入寫評論。