Neodynamic Barcode Professional 2.0 for ASP.NET or greater
Neodynamic Barcode Professional 2.0 for Windows Forms or greater
Microsoft .NET Framework (any version)
Microsoft Visual Studio .NET (any version)
Create ASP.NET Web Services that needs to serve barcode images, is easier than ever with Barcode Professional (for ASP.NET or for Windows Forms). Barcode Professional now includes a method that allows you to return a byte array of the generated barcode image - a byte array is the object needed to server images in a Web Service project.
In the following sample, we'll create an ASP.NET Web Service project that allows you to serve barcode Code 128 images.
Follow these steps
_
Public Function GetBarcodeCode128(ByVal valueToEncode As String) As Byte()
Dim bcp As BarcodeProfessional = New BarcodeProfessional
bcp.Symbology = Symbology.Code128
bcp.Code = valueToEncode
bcp.Text = "From Web Service!"
bcp.ForeColor = System.Drawing.Color.Red
Return bcp.GetBarcodeImage(System.Drawing.Imaging.ImageFormat.Gif)
End Function
[WebMethod,Description("Generates a Code 128 barcode image")]
public byte[] GetBarcodeCode128(string valueToEncode)
{
BarcodeProfessional bcp = new BarcodeProfessional();
bcp.Symbology = Symbology.Code128;
bcp.Code = valueToEncode;
bcp.Text = "From Web Service!";
bcp.ForeColor = System.Drawing.Color.Red;
return
bcp.GetBarcodeImage(System.Drawing.Imaging.ImageFormat.Gif);
}
That's it. We're ready to serve barcode images from our Web Service. Build the ASP.NET Web Service application, run it and play with it.
After click on Invoke button you'll get this:
Now, we're going to create a client to consume this Web Service. This client will be a Windows Forms Application.
Follow these steps
Dim bcws As BarcodeWS.BarcodeProfessionalWS = New BarcodeWS.BarcodeProfessionalWS
Dim barcodeImage As Byte() = bcws.GetBarcodeCode128(textBox1.Text)
Dim bmp As Bitmap = CType(Bitmap.FromStream(New System.IO.MemoryStream(barcodeImage)), Bitmap)
pictureBox1.Image = bmp
BarcodeWS.BarcodeProfessionalWS bcws = new BarcodeWS.BarcodeProfessionalWS();
byte[] barcodeImage = bcws.GetBarcodeCode128(textBox1.Text);
Bitmap bmp = (Bitmap) Bitmap.FromStream(new System.IO.MemoryStream(barcodeImage));
pictureBox1.Image = bmp;
That's it. We're ready to consume barcode images from the Barcode Web Service. Build the application, run it and play with it.
We provide best-in-class customer service and support directly from members of our dev team! If we are available when you contact us, you will get a response in few minutes; otherwise the maximum turnaround is 24hs in most cases.