Home > Net >  C # call BarTender SDK cannot print issue
C # call BarTender SDK cannot print issue

Time:10-10

I invoke the BarTender SDK to print bar code in c #, appear such problem: packaged into program. Exe files in my computer the machine installation does not have any problem printing, but get installed on user's computer cannot print, and no any error messages, and there is no message. The BarTender version is 7.75, the printer is TSC TTP - 244 Pro, my computer system is Windows 7 system, the user's computer is Windows xp, the code is also on the Internet looking for:
 try 
{
BarTender. Application btApp;
BarTender. Format btFormat;
BtApp=new BarTender. ApplicationClass ();
BtApp. Visible=false;
BtFormat=btApp. Formats. Open (Path, false, "");
BtFormat. SetNamedSubStringValue (SubStringName, barcode);
BtFormat. PrintOut (false, false);
BtFormat. Close (BarTender. BtSaveOptions. BtSaveChanges);
}
The catch (Exception ex)
{
Throw the ex.
}

Has the friend to help to solve the problem of similar to see, for several days

CodePudding user response:

Good morning, everyone!
Someone asked such a question in BBS, but didn't see the last is how to solve of,

CodePudding user response:

Remove the catch and then increase the diagnostic log

CodePudding user response:

I believe that the code should be no problem, because the code executed print bar code on the user's computer, have successfully saved to the data, and displayed on the page, I suspect driver is not the same at first, later I again on the user's computer reinstall driver, but still won't do,

CodePudding user response:

BarTender software on my computer, a printer driver is copied in the user, and user's printer to print on my computer, no problem,

CodePudding user response:

//load the printing template
Private BarTender. Application btApp1;
BtApp1=new BarTender. Application ();

Private bool AutoPrint (int count, string code, string _nature1, string _nature2, string _nature3)
{
Try
{
//StreamWriter printOutWriter=new StreamWriter (@ "E: \ ADC_151027 \ Johnson ADC \ Johnson ADC \ Johnson Print_EDI \ bin \ Release \ printOut TXT");
//printOutWriter. WriteLine (code);
BtFormat. PrintSetup. NumberSerializedLabels=1;//printnumber;
BtFormat. PrintSetup. IdenticalCopiesOfLabel=count;
BtFormat. PrintSetup. Printer=Print_NameLR;

BtFormat. SetNamedSubStringValue (" BarDate, "DateTime. Now. ToString (" yyyy - MM - dd"));
BtFormat. SetNamedSubStringValue (" Bartime, "DateTime. Now. ToString (" HH: mm: ss"));
BtFormat. SetNamedSubStringValue (" Barcode1 ", code);
BtFormat. SetNamedSubStringValue (" alccode ", code the Substring (10, 5));
BtFormat. SetNamedSubStringValue (" sx1 _nature1);
BtFormat. SetNamedSubStringValue (" sx2 _nature2);
BtFormat. SetNamedSubStringValue (" sx3 _nature3);
BtFormat. SetNamedSubStringValue (" BarCode2 ", code);
BtFormat. PrintOut (false, false);
//btFormat. Close (BarTender. BtSaveOptions. BtDoNotSaveChanges);//exits whether save the tag
//
return true;
}
The catch (Exception ex)
{
MessageBox. Show (" print error "+ ex. The Message," Message ");
Return false;
}
}

CodePudding user response:

BtFormat. PrintSetup. NumberSerializedLabels=1;//printnumber;
BtFormat. PrintSetup. IdenticalCopiesOfLabel=count;
BtFormat. PrintSetup. Printer=Print_NameLR;
I'm not with this a few lines of code, the key is in my computer can print out the barcode, on the user's computer can't print. Computers have only a default printer, don't know what set the BarTender software there

CodePudding user response:

Call the BarTender print need to install the server-side SLS94_2760 SDK. The exe

CodePudding user response:


There could be many reason that I say first I use BarTender10.1 do secondary development feelings,

Rule out the reason for your application, your application simply presents the open template engine, assignment, print, shut off the process template, don't show the problem,

A. You just pack. Exe file is useless, must deploy the installation package, because you quoted the Seagull. BarTender. Print this DLL file, it will link to other libraries,
After the packaging, on the other computer installation is complete, you will find that the installation directory for many more puzzling you inside the program without reference library,

Because I made the mistakes before, it is necessary to deploy installation package, you put your DLL and the. Exe packaging copies to other computers it's no use, must use no,

2. After the package installation to the other computer class possible problems,

1. The first BarTender this thing is very strange, if your program drive three or more printer at the same time, and you don't have to provide driver BarTender himself, the vendor's driver, just using the TSC tianjin will find printers are not controlled by your program, so, if you need to drive more printer, suggest not to use the TSC printer vendors drive, even if you only drive a, advice also provide the driver with the BarTender himself, my own experience,

2. Your template to print properties, check the use data source input, not check will go wrong,

3. And your printer port is choose by the way, if you are on a computer connected to three or more USB data port printer at the same time, your computer or USB cable, plug the printer to print opportunity list of,

4. How long is the length of your USB cable? If more than 3 meters, generally is not the printer, because the power supply is insufficient, it is recommended to use about 1 meter cable, because before encountered this problem, bought with 5 meters cable, found that can't drive, a cutter, cut the cable and connect into 3 meters,


If you solve all these problems, also a problem, is fit again drive, and if there is a problem, that is the reason why you program,

Also, why did you close the template, print once every time open the template before printing, print out then close the template, it is quite trouble ah, you are only print it again?

If is a continuous printing, after open the template engine, don't close the template, the template only after you don't have a template close, engine also close,



CodePudding user response:

To: heihei5413
I checked my computer is not installed SLS94_2760. Exe, just installed BarTender7.75 , is referenced DLL Interop. The BarTender. DLL, can the normal print.

CodePudding user response:

To: SCGH_Fx
Thank you very much for your detailed answers,
1. At first I didn't express clearly, in fact, I also will be related the DLL into deployment of the client for the installation, installation of packages are not just copy exe file to install, program I use to Interop. The BarTender. DLL to print,
2. I install the driver from the user to copy back, there is that vendors give them, they say, should be no problem,
3. There was only one printer on the user's computer. They are also set to the default printer, at that time I also try to install the software to them will be changed two USB printer interface. But cannot print,
4. Each print should be opened and closed operation is inappropriate, later I will adjust, thank you for reminding me.
The question now is I don't understand why you can print on my computer, the user computer wouldn't work, and no any error, the execution logic is done,
//1. Print the barcode 
BarTenderHelper barTender=new BarTenderHelper (path);
BarTender. PrintBarcode (barcode);
//2. Save the barcode to the DB
Dao. SaveBarcode (barcode, LoginInfo LoginNO);
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  •  Tags:  
  • C#
  • Related