Пример #1
0
        public virtual void Barcode03Test()
        {
            PdfDocument document = new PdfDocument(new PdfWriter(new ByteArrayOutputStream()));
            Barcode39   barcode  = new Barcode39(document);

            try {
                Barcode39.GetBarsCode39("9781935*182610");
                NUnit.Framework.Assert.Fail("IllegalArgumentException expected");
            }
            catch (ArgumentException) {
            }
        }
Пример #2
0
        public virtual void Barcode02Test()
        {
            String      filename = "barcode39_02.pdf";
            PdfDocument document = new PdfDocument(new PdfReader(sourceFolder + "DocumentWithTrueTypeFont1.pdf"), new
                                                   PdfWriter(destinationFolder + filename));
            PdfCanvas canvas  = new PdfCanvas(document.GetLastPage());
            Barcode1D barcode = new Barcode39(document);

            barcode.SetCode("9781935182610");
            barcode.SetTextAlignment(Barcode1D.ALIGN_LEFT);
            barcode.PlaceBarcode(canvas, Color.BLACK, Color.BLACK);
            document.Close();
            NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + filename, sourceFolder
                                                                             + "cmp_" + filename, destinationFolder, "diff_"));
        }
Пример #3
0
        public virtual void Barcode01Test()
        {
            String      filename = "barcode39_01.pdf";
            PdfDocument document = new PdfDocument(new PdfWriter(destinationFolder + filename));
            PdfPage     page     = document.AddNewPage();
            PdfCanvas   canvas   = new PdfCanvas(page);
            Barcode1D   barcode  = new Barcode39(document);

            barcode.SetCode("9781935182610");
            barcode.SetTextAlignment(Barcode1D.ALIGN_LEFT);
            barcode.PlaceBarcode(canvas, ColorConstants.BLACK, ColorConstants.BLACK);
            document.Close();
            NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + filename, sourceFolder
                                                                             + "cmp_" + filename, destinationFolder, "diff_"));
        }