【发布时间】:2019-01-23 16:14:37
【问题描述】:
您好,我目前正在使用 itextsharp 在我的 C# 窗口应用程序上创建一个简单的导出 pdf 函数。我已经成功生成了带有条形码的 PDF,是否可以生成底部没有文字的条形码?
这是我生成条形码并放入 itextsharp 上的表格单元格的代码:
iTextSharp.text.pdf.Barcode128 bc = new Barcode128();
bc.TextAlignment = Element.ALIGN_CENTER;
bc.Code = palletID;
bc.StartStopText = false;
bc.CodeType = iTextSharp.text.pdf.Barcode128.CODE128;
bc.X = 1f;
bc.Extended = true;
iTextSharp.text.Image PatImage1 = bc.CreateImageWithBarcode(cb, iTextSharp.text.BaseColor.BLACK, iTextSharp.text.BaseColor.BLACK);
PatImage1.ScaleAbsolute(480f, 175.25f);
PdfPCell palletBarcodeCell = new PdfPCell(PatImage1);
palletBarcodeCell.Border = iTextSharp.text.Rectangle.RIGHT_BORDER | iTextSharp.text.Rectangle.TOP_BORDER | iTextSharp.text.Rectangle.BOTTOM_BORDER;
palletBarcodeCell.Colspan = 2;
palletBarcodeCell.FixedHeight = 61f;
palletBarcodeCell.HorizontalAlignment = 1;
palletBarcodeCell.VerticalAlignment = 1;
table.AddCell(palletBarcodeCell);
我无法通过谷歌或论坛找到任何解决方案。这里的任何专家可以帮助我吗?谢谢
【问题讨论】:
-
bc.Font = null;