Spire.Barcode is a professional barcode library specially designed for .NET developers (C#, VB.NET, ASP.NET, .NET Core) and Java developers (J2SE and J2EE) to generate, read and scan 1D & 2D barcodes.

Thu Sep 10, 2015 4:14 pm

Good day, I am trying to use spire in an MVC application after going through the Demo of it in C#.

Firstly, I have this code.
Code: Select all
  public string CreateBarcodeCreate(string BarcodeText,string by,string subject,string id)
           string barcodeSavePath = HttpContext.Current.Server.MapPath(this._barcodePath + id.ToString() + ".png");
            BarcodeSettings setting = new BarcodeSettings();
            setting.Data = BarcodeText + by + subject + id;
            setting.Type = BarCodeType.Code128;
//            setting.TopText = BarcodeText + by + subject + id;

and I am trying to print out the top text in the format similar to what was produced in the example C app.
However TopText is not working, and the only way I can get this text on the barcode is if I put it in Data.

Secondly, If this bar code is scan. What will be returned? Everything entered in setting.data?


PS : I have removed the logo, but if i leave both data and toptext blank it shows "12345" as a default

kemnet
 
Posts: 5
Joined: Mon Aug 17, 2015 5:19 pm

Thu Sep 10, 2015 4:36 pm

ok, I found that there was a property i needed to set.
setting.ShowTopText = true;
However i still see 12345 if I dont set the data .
Is the data field what is read by the scanner?

kemnet
 
Posts: 5
Joined: Mon Aug 17, 2015 5:19 pm

Fri Sep 11, 2015 7:43 am

Hello,

Thanks for your inquiry.
1) If scanning the barcode, everything entered in setting.data will be returned. According to the different BarCodeType, other data also will be retured, like the check digit.
2) I have tested your issue with Spire.BarCode for .NET Version:1.2.5. If I leave data blank, it will throw Exception and there will be no any output. Could you please offer us your more complete code? It would be helpful to replicate the issue and work out the solution for you ASAP.

Best Regards,
Sweety
E-iceblue support team
User avatar

sweety1
 
Posts: 539
Joined: Wed Mar 11, 2015 1:14 am

Fri Sep 18, 2015 12:18 pm

Ok thanks, I have actually solved part of my issue. but I have another.\
imagine this code snippet
Code: Select all
public string CreateBarcodeCreate(string id)
            BarcodeSettings setting = new BarcodeSettings();
            setting.Data =  id;



Correct me if I am wrong but this creates a barcode that when scanned will return the "id" right?

If so, why is this "id" printed on the barcode label (just below the top text) and how can i remove it

kemnet
 
Posts: 5
Joined: Mon Aug 17, 2015 5:19 pm

Mon Sep 21, 2015 6:11 am

Hello,

Please try the below line:
Code: Select all
setting.ShowText = false;


Best wishes,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2428
Joined: Wed Jun 27, 2012 8:50 am

Mon Jul 09, 2018 8:16 pm

What was the solution. I do always get 12345. Even if the text is something else. So very similiar. Thank you

newcommervcc
 
Posts: 2
Joined: Mon Jul 09, 2018 7:51 am

Tue Jul 10, 2018 2:39 am

Dear newcommervcc,

Thanks for your inquiry.
There is that default text "12345" if you don't set the displayed text on the top. Please try to use the property settings.Data2D to set the text.
Code: Select all
              //the data on the barcode which will be scanned by scanner
              settings.Data = "12345678910";
              //the data will show on the top
              settings.Data2D = "12345678910";

If you still have the issue, please provide your code for further investigation.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3067
Joined: Tue Sep 06, 2016 8:30 am

Tue Jul 10, 2018 7:01 am

Thank you. This solved the point

newcommervcc
 
Posts: 2
Joined: Mon Jul 09, 2018 7:51 am

Tue Jul 10, 2018 7:23 am

Dear newcommervcc,

Thanks for your feedback.
Please feel free to contact us if there is any question.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3067
Joined: Tue Sep 06, 2016 8:30 am

Return to Spire.BarCode