跳到主内容

搜索

搜索

Problem With Checking Print Result

评论

2 条评论

  • Avatar
    Ian Cummings
    版主

    Maybe you'd want to specify a time out.  Also try fault finding things by seeing what messages are returned by the print request.  See the below example from the BarTender Help system:

     

    public void Demo()
    {
       // Initialize a new BarTender print engine.
       using (Engine btEngine = new Engine())
       {
          // Start the BarTender print engine.
          btEngine.Start();
    
          // Open a format document.
          LabelFormatDocument btFormat = btEngine.Documents.Open(@"C:\Format1.btw");
    
          // Print the format document specifying the job name,
          // and get any messages returned.
          Messages btMessages = null;
          Result nResult = btFormat.Print("Test Print", out btMessages);
    
          // Display the print result.
          Console.WriteLine("Print status = " + nResult);
    
          // Print all returned messages.
          foreach (Message m in btMessages)
          {
             Console.WriteLine("Category = " + m.Category);
             Console.WriteLine("ID = " + m.ID);
             Console.WriteLine("Severity = " + m.Severity);
             Console.WriteLine("Text = " + m.Text);
             Console.WriteLine(" ");
          }
    
          // Close the current format without saving.
          btFormat.Close(SaveOptions.DoNotSaveChanges);
    
          // Stop the BarTender print engine.
          btEngine.Stop();
       }
    }
    
    0
  • Avatar
    Legacy Poster

    Thank you for your answer.

     

    When I use this: 

    ress = labelFormat.Print("Label for " + txtPN.Text, out mess)
    
    if(ress != Result.Success)
    {
        // error
    }
    else
    {
        // Save data to DB
    }
    

    All is OK and data are saved in DB.

     

    What is the difference between this?

    if(labelFormat.Print("Label for " + txtPN.Text, out mess) != Result.Success)
    {
        // error
    }
    else
    {
        // Save data to DB
    }
    

    This throws error (but label is printed), why? It's the same.

     

     

    I'm sorry for my bad english...

    0

请先登录再写评论。