Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Zxing for QRCode generate
Message
Information générale
Forum:
ASP.NET
Catégorie:
Controls activeX
Versions des environnements
Environment:
VB 9.0
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01580944
Message ID:
01581608
Vues:
39
>Hi every body :
>
>Can somebody give me basic sample code to generate QRCode with zxing.dll using VB.NET ?
>Iam looking for basic samples or step by step tutorial.
>
>thanks a lot!
>
>Carlos Alberto Morales

I don't have any VB.NET code, but here's a sample C# method that will generate a PNG file and save it:
        public void Write(string barcodeText, string fileName, int width, int height)
        {
            MultiFormatWriter zx = new MultiFormatWriter();
            var barcode = zx.encode(barcodeText, BarcodeFormat.QR_CODE, width, height);
            var bitmap = new Bitmap(barcode.Width, barcode.Height);

            for (int y = 0; y < barcode.Height; y++)
            {
                for (int x = 0; x < barcode.Width; x++)
                {
                    int grayValue = barcode.Array[y][x] & 0xFF;

                    bitmap.SetPixel(x, y, (grayValue == 0 ? Color.Black : Color.White));
                }
            }

            bitmap.Save(fileName, ImageFormat.Png);
        }
-Paul

RCS Solutions, Inc.
Blog
Twitter
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform