private Cell CreateBarcode(string code, PdfDocument pdfDoc, PDFQRConfiguration settings) { var barcode = new Barcode39(pdfDoc); barcode.SetCodeType(Barcode39.ALIGN_CENTER); barcode.SetCode(code); barcode.SetBarHeight(settings.Height); barcode.FitWidth(settings.Width); // Create barcode object to put it to the cell as image var barcodeObject = barcode.CreateFormXObject(null, null, pdfDoc); var cell = new Cell().Add(new Image(barcodeObject)); cell.SetPaddingTop(settings.CellPaddingTop); cell.SetPaddingRight(settings.CellPaddingRight); cell.SetPaddingBottom(settings.CellPaddingBottom); cell.SetPaddingLeft(settings.CellPaddingLeft); cell.SetBorder(new iText.Layout.Borders.DottedBorder(iText.Kernel.Colors.ColorConstants.LIGHT_GRAY, 1)); return(cell); }