Esempio n. 1
0
        public virtual void Barcode02Test()
        {
            String      filename = "barcode128_02.pdf";
            PdfWriter   writer   = new PdfWriter(destinationFolder + filename);
            PdfReader   reader   = new PdfReader(sourceFolder + "DocumentWithTrueTypeFont1.pdf");
            PdfDocument document = new PdfDocument(reader, writer);
            PdfCanvas   canvas   = new PdfCanvas(document.GetLastPage());
            Barcode1D   barcode  = new Barcode128(document);

            barcode.SetCodeType(Barcode128.CODE128);
            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_"));
        }
Esempio n. 2
0
        public virtual void Barcode01Test()
        {
            String      filename = "barcode128_01.pdf";
            PdfWriter   writer   = new PdfWriter(destinationFolder + filename);
            PdfDocument document = new PdfDocument(writer);
            PdfPage     page     = document.AddNewPage();
            PdfCanvas   canvas   = new PdfCanvas(page);
            Barcode1D   barcode  = new Barcode128(document);

            barcode.SetCodeType(Barcode128.CODE128);
            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_"));
        }
Esempio n. 3
0
 public virtual void BarcodeRawValueGenerationTest01()
 {
     NUnit.Framework.Assert.AreEqual(iText.IO.Util.JavaUtil.GetStringForBytes(new byte[] { 103, 17, 18, 19, 20,
                                                                                           21, 17, 18, 19, 20, 21 }), Barcode128.GetRawText("1234512345", false, Barcode128.Barcode128CodeSet.A));
 }