public virtual void Barcode02Test() { String filename = "barcodeEAN_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 BarcodeEAN(document); barcode.SetCodeType(BarcodeEAN.EAN8); barcode.SetCode("97819351"); 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_")); }
public virtual void Barcode01Test() { String filename = "barcodeEAN_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 BarcodeEAN(document); barcode.SetCodeType(BarcodeEAN.EAN13); 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_")); }