예제 #1
0
        public virtual void Barcode02Test()
        {
            String      filename = "barcodeMSI_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 BarcodeMSI(document);

            barcode.SetCode("9781935182610");
            barcode.SetTextAlignment(Barcode1D.ALIGN_LEFT);
            barcode.PlaceBarcode(canvas, ColorConstants.BLACK, ColorConstants.WHITE);
            document.Close();
            NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(destinationFolder + filename, sourceFolder
                                                                             + "cmp_" + filename, destinationFolder, "diff02_"));
        }
예제 #2
0
        public virtual void Barcode01Test()
        {
            String      filename = "barcodeMSI_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 BarcodeMSI(document);

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