예제 #1
0
        public void BarcodeTest13()
        {
            String filename = "barcodeDataMatrix13.pdf";
            String code     = "AAAAAAAAAA;BBBBAAAA3;00028;BBBAA05;AAAA;AAAAAA;1234567;AQWXSZ;JEAN;;;;7894561;AQWXSZ;GEO;;;;1;1;1;1;0;0;1;0;1;0;0;0;1;0;1;0;0;0;0;0;0;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1";

            Document  document = new Document(PageSize.A4);
            PdfWriter writer   = PdfWriter.GetInstance(document, new FileStream(outFolder + filename, FileMode.Create));

            document.Open();
            document.Add(new Paragraph("Datamatrix test 13"));
            PdfContentByte cb = writer.DirectContent;

            cb.ConcatCTM(AffineTransform.GetTranslateInstance(PageSize.A4.Width / 2 - 100, PageSize.A4.Height / 2 - 100));
            BarcodeDatamatrix barcode = new BarcodeDatamatrix();

            barcode.Options = BarcodeDatamatrix.DM_RAW;
            barcode.Generate(code);
            barcode.PlaceBarcode(cb, BaseColor.GREEN, 5, 5);
            document.Close();

            CompareDocuments(filename);
        }
        public void BarcodeTest02()
        {
            String filename = "barcodeDataMatrix02.pdf";
            String code     = "дима";
            String encoding = "UTF-8";

            Document  document = new Document(PageSize.A4);
            PdfWriter writer   = PdfWriter.GetInstance(document, new FileStream(outFolder + filename, FileMode.Create));

            document.Open();
            document.Add(new Paragraph("Datamatrix test 02"));
            PdfContentByte cb = writer.DirectContent;

            cb.ConcatCTM(AffineTransform.GetTranslateInstance(PageSize.A4.Width / 2 - 100, PageSize.A4.Height / 2 - 100));
            BarcodeDatamatrix barcode = new BarcodeDatamatrix();

            barcode.Generate(code, encoding);
            barcode.PlaceBarcode(cb, BaseColor.GREEN, 5, 5);
            document.Close();

            CompareDocuments(filename);
        }
예제 #3
0
        public void BarcodeTest04()
        {
            String filename = "barcodeDataMatrix04.pdf";
            String code     = "01AbcdefgAbcdefg123451231231234";

            Document  document = new Document(PageSize.A4);
            PdfWriter writer   = PdfWriter.GetInstance(document, new FileStream(outFolder + filename, FileMode.Create));

            document.Open();
            document.Add(new Paragraph("Datamatrix test 04"));
            PdfContentByte cb = writer.DirectContent;

            cb.ConcatCTM(AffineTransform.GetTranslateInstance(PageSize.A4.Width / 2 - 100, PageSize.A4.Height / 2 - 100));
            BarcodeDatamatrix barcode = new BarcodeDatamatrix();

            barcode.Width  = 36;
            barcode.Height = 12;
            barcode.Generate(code);
            barcode.PlaceBarcode(cb, BaseColor.BLACK, 5, 5);
            document.Close();

            CompareDocuments(filename);
        }