Esempio n. 1
0
        public virtual void Barcode01Test()
        {
            String      filename = "barcodeQRCode01.pdf";
            PdfWriter   writer   = new PdfWriter(destinationFolder + filename);
            PdfDocument document = new PdfDocument(writer);
            PdfPage     page     = document.AddNewPage();
            PdfCanvas   canvas   = new PdfCanvas(page);
            IDictionary <EncodeHintType, Object> hints = new Dictionary <EncodeHintType, Object>();

            hints.Put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.L);
            BarcodeQRCode barcode = new BarcodeQRCode("some specific text 239214 hello world");

            barcode.PlaceBarcode(canvas, Color.GRAY, 12);
            document.Close();
            NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + filename, sourceFolder
                                                                             + "cmp_" + filename, destinationFolder, "diff_"));
        }
Esempio n. 2
0
        public virtual void Barcode02Test()
        {
            String      filename = "barcodeQRCode02.pdf";
            PdfWriter   writer   = new PdfWriter(destinationFolder + filename);
            PdfDocument document = new PdfDocument(writer);
            PdfPage     page1    = document.AddNewPage();
            PdfCanvas   canvas   = new PdfCanvas(page1);
            IDictionary <EncodeHintType, Object> hints = new Dictionary <EncodeHintType, Object>();

            hints.Put(EncodeHintType.CHARACTER_SET, "UTF-8");
            BarcodeQRCode barcode1 = new BarcodeQRCode("дима", hints);

            barcode1.PlaceBarcode(canvas, Color.GRAY, 12);
            document.Close();
            NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + filename, sourceFolder
                                                                             + "cmp_" + filename, destinationFolder, "diff_"));
        }
        public virtual void BarcodeVersioningTest()
        {
            String      filename = "barcodeQRCodeVersioning.pdf";
            PdfWriter   writer   = new PdfWriter(destinationFolder + filename);
            PdfDocument document = new PdfDocument(writer);

            for (int i = -9; i < 42; i += 10)
            {
                PdfPage   page1  = document.AddNewPage();
                PdfCanvas canvas = new PdfCanvas(page1);
                IDictionary <EncodeHintType, Object> hints = new Dictionary <EncodeHintType, Object>();
                hints[EncodeHintType.CHARACTER_SET]  = "UTF-8";
                hints[EncodeHintType.MIN_VERSION_NR] = i;
                BarcodeQRCode barcode1 = new BarcodeQRCode("дима", hints);
                barcode1.PlaceBarcode(canvas, Color.GRAY, 3);
            }
            document.Close();
            NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + filename, sourceFolder
                                                                             + "cmp_" + filename, destinationFolder, "diff_"));
        }