public static void Run()
        {
            // ExStart:CreatePdf417BarcodeWithTurkishCharacters
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_ManageBarCodes();
            const string codetext = "AYŞE" + "\n" + "Ümit" + "\n" + "Ü[email protected]" + "\n" + "Türkiye";

            // Generate the barcode
            BarCodeBuilder builder = new BarCodeBuilder(codetext, EncodeTypes.Pdf417);

            // Encode the code text and  Set the display text
            byte[] bytes = Encoding.GetEncoding(1254).GetBytes(codetext);
            builder.SetBinaryCodeText(bytes);
            builder.Display2DText = codetext;
            builder.Save(dataDir + "CreatePdf417BarcodeWithTurkishCharacters_out.png");
            // ExEnd:CreatePdf417BarcodeWithTurkishCharacters
        }
        public static void Run()
        {
            // ExStart:CreatePdf417BarcodeWithTurkishCharacters
            // The path to the documents directory.
            string       dataDir  = RunExamples.GetDataDir_ManageBarCodes();
            const string codetext = "AYŞE" + "\n" + "Ümit" + "\n" + "Ü[email protected]" + "\n" + "Türkiye";

            // Generate the barcode
            BarCodeBuilder builder = new BarCodeBuilder(codetext, EncodeTypes.Pdf417);

            // Encode the code text and  Set the display text
            byte[] bytes = Encoding.GetEncoding(1254).GetBytes(codetext);
            builder.SetBinaryCodeText(bytes);
            builder.Display2DText = codetext;
            builder.Save(dataDir + "CreatePdf417BarcodeWithTurkishCharacters_out.png");
            // ExEnd:CreatePdf417BarcodeWithTurkishCharacters
        }
Esempio n. 3
0
        public static void Run()
        {
            try
            {
                // ExStart:GenerateAndRecognizeUTF8Characters
                // The path to the documents directory.
                string dataDir = RunExamples.GetDataDir_ManageBarCodes();

                // Generate the barcode
                Bitmap         imgBarcode        = null;
                BarCodeBuilder objBarCodeBuilder = new BarCodeBuilder {
                    EncodeType = EncodeTypes.MacroPdf417
                };

                // Set the codetext by converting it into unicode byte array
                byte[] byteArray = Encoding.Unicode.GetBytes("منحة");
                objBarCodeBuilder.SetBinaryCodeText(byteArray);
                imgBarcode = objBarCodeBuilder.GenerateBarCodeImage();
                imgBarcode.Save(dataDir + "GenerateAndRecognizeUTF8Characters_out.png");

                // Recognize the above barcode
                BarCodeReader reader = new BarCodeReader(dataDir + "GenerateAndRecognizeUTF8Characters_out.png");
                while (reader.Read())
                {
                    Encoding unicode = Encoding.Unicode;

                    // Get the characters array from the bytes
                    char[] unicodeChars = new char[unicode.GetCharCount(reader.GetCodeBytes(), 0, reader.GetCodeBytes().Length)];
                    unicode.GetChars(reader.GetCodeBytes(), 0, reader.GetCodeBytes().Length, unicodeChars, 0);

                    // Build unicode string
                    string strCodeText = new string(unicodeChars);
                    Console.WriteLine(strCodeText);
                }
                reader.Close();
                // ExEnd:GenerateAndRecognizeUTF8Characters
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose License. You can purchase full license or get 30 day temporary license from http://www.aspose.com/purchase/default.aspx.");
            }
        }
        public static void Run()
        {
            try
            {
                // ExStart:GenerateAndRecognizeUTF8Characters
                // The path to the documents directory.
                string dataDir = RunExamples.GetDataDir_ManageBarCodes();

                // Generate the barcode
                Bitmap imgBarcode = null;
                BarCodeBuilder objBarCodeBuilder = new BarCodeBuilder {EncodeType = EncodeTypes.MacroPdf417};
                
                // Set the codetext by converting it into unicode byte array
                byte[] byteArray = Encoding.Unicode.GetBytes("منحة");
                objBarCodeBuilder.SetBinaryCodeText(byteArray);
                imgBarcode = objBarCodeBuilder.GenerateBarCodeImage();
                imgBarcode.Save(dataDir + "GenerateAndRecognizeUTF8Characters_out.png");

                // Recognize the above barcode
                BarCodeReader reader = new BarCodeReader(dataDir + "GenerateAndRecognizeUTF8Characters_out.png");
                while (reader.Read())
                {
                    Encoding unicode = Encoding.Unicode;
                   
                    // Get the characters array from the bytes
                    char[] unicodeChars = new char[unicode.GetCharCount(reader.GetCodeBytes(), 0, reader.GetCodeBytes().Length)];
                    unicode.GetChars(reader.GetCodeBytes(), 0, reader.GetCodeBytes().Length, unicodeChars, 0);
                    
                    // Build unicode string
                    string strCodeText = new string(unicodeChars);
                    Console.WriteLine(strCodeText);
                }
                reader.Close();
                // ExEnd:GenerateAndRecognizeUTF8Characters
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose License. You can purchase full license or get 30 day temporary license from http://www.aspose.com/purchase/default.aspx.");
            }
        }