【问题标题】:C# iTextSharp Barcode Code128 Without TextC# iTextSharp Barcode Code128 无文本
【发布时间】: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;

标签: c# itext


【解决方案1】:

我想我找到了另一种方法。

通过使用它在条形码那里放置文本为空

 bc.AltText = palletID; //Alternative Text on barcode

【讨论】:

    【解决方案2】:

    设置字体为空 示例:

    bc.Font = null;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-27
      • 2014-06-03
      • 2023-02-02
      • 1970-01-01
      • 2012-07-19
      • 1970-01-01
      相关资源
      最近更新 更多