Cant Print Bartender Label From C Shar フォローする

0
Avatar
Legacy Poster

Hello there,

I can't print label from c sharp my function source code is:

private void Issue_Labels()
        {
            using(Seagull.BarTender.Print.Engine btEngine= new Seagull.BarTender.Print.Engine())
            {
                Seagull.BarTender.Print.LabelFormatDocument btFormat;
                btEngine.Start();
                // Show BarTender UI for debugging purpose (Set "None" to hide)
                //btEngine.Window.VisibleWindows = Seagull.BarTender.Print.VisibleWindows.All;
 
                btFormat = btEngine.Documents.Open(Program.LabelPath);
 
                // Print
                btFormat.Print();
                Thread.Sleep(164);
                btEngine.Stop();
            }
 
        }
I got an error when i called this function, check please the error1.txt file.
I also changed the app config file to:
</configSection>
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
  </startup>
</configuration>
 

 

4 コメント

0
Avatar
Ian Cummings
モデレータ
コメントアクション Permalink

It looks like BarTender is unable to open the document as the file cannot be found:

 

Make sure you prefix the path/filename with the @ string literal escape character.

 

Example: LabelFormatDocument btFormat = btEngine.Documents.Open(@"c:\MyLabel.btw");

 

I would guess this is why the file is not being found.

0
Avatar
Legacy Poster
コメントアクション Permalink

Thanks a lot,

Now it is printing with this code:

using (Seagull.BarTender.Print.Engine btEngine = new Seagull.BarTender.Print.Engine())
            {
                Seagull.BarTender.Print.LabelFormatDocument btFormat;
                btEngine.Start();
                // Show BarTender UI for debugging purpose (Set "None" to hide)
                //btEngine.Window.VisibleWindows = Seagull.BarTender.Print.VisibleWindows.All;
 
                btFormat = btEngine.Documents.Open(Program.LabelPath);
 
                // Print
                btFormat.Print();
                Thread.Sleep(164);
                btEngine.Stop();
            }
But it's print 2 labels, I need only one label.
Can I set the number of copies ?
Best Regards
Hamzi
0
Avatar
Ian Cummings
モデレータ
コメントアクション Permalink

You'd want to set the IndenticalCopiesOfLabel property, otherwise it inherits whatever is set in the document file itself.

 

// Set the number of copies.
btFormat.PrintSetup.IdenticalCopiesOfLabel = 1;
0
Avatar
Legacy Poster
コメントアクション Permalink

Thanks a lot for your fat answer, I will check this.

Best regards

Hamzi.

ログインしてコメントを残してください。