首页 > 解决方案 > 贴标机上打印的 Code39 不可读

问题描述

我正在尝试使用贴标机(argox x-2300e)打印code39,所以代码是这样的(我删除了所有的东西,只打印一个条形码来测试):

Imports System.ComponentModel
Imports System.Drawing.Printing

Public Class Form1

  Dim linea1 As String = "*A0-121244$K0001196AA-UK*"

  Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    Dim psz2 As New Printing.PaperSize
    psz2.RawKind = Printing.PaperKind.Custom
    psz2.Width = 217
    psz2.Height = 314

    PrintDocument2.DefaultPageSettings.PaperSize = psz2
    PrintDocument2.DefaultPageSettings.Margins = New Margins(0, 0, 0, 0)
    PrintDocument2.DefaultPageSettings.Landscape = False
    PrintDocument2.PrinterSettings.Copies = 1

    PrintDocument2.PrinterSettings.PrinterName = "\\ETIC1\Argox X-2300E series PPLB"

    PrintPreviewDialog2.Size = New System.Drawing.Size(500, 750)
    PrintPreviewDialog2.ShowDialog()
  End Sub

  Private Sub PrintDocument2_PrintPage(sender As Object, e As PrintPageEventArgs) Handles PrintDocument2.PrintPage
    Dim drawFormat As New StringFormat
    drawFormat.Alignment = StringAlignment.Center

    e.Graphics.ScaleTransform(1, 3)
    e.Graphics.DrawString(linea1, New Font("IDAHC39M Code 39 Barcode", 6, FontStyle.Regular), Brushes.Black, New Rectangle(0, 2, 217, 50), drawFormat)
    e.Graphics.DrawString(linea1, New Font("Free 3 of 9", 14, FontStyle.Regular), Brushes.Black, New Rectangle(0, 55, 217, 50), drawFormat)
    e.Graphics.ScaleTransform(1, 1 / 3)
    e.Graphics.DrawLine(New Pen(Brushes.Black, 0.5), New Point(15, 250), New Point(202, 250))
  End Sub

  Private Sub PrintPreviewDialog2_Closing(sender As Object, e As CancelEventArgs) Handles PrintPreviewDialog2.Closing
    Application.Exit()
  End Sub
End Class

现在,问题是这样的:

我打印标签,但我们的扫描仪无法读取条形码(扫描仪与我们最大的客户相同)

使用大小为 16 的“free 3 to 9”字体是代码每次可读的最小大小,但这超出了标签的尺寸。

使用“IDAHC39M Code 39 Barcode”字体,必须至少为 8 号才能阅读。(但这仍然超出标签的尺寸)

我在 2 个代码下画了一条线,它表示使用打印机本身附带的贴标软件生成的相同条形码的宽度,即使它更小,它也完全可读标签为 55mm x 80mm

在此处输入图像描述

如何使标签内的代码可读?我错过了什么?

标签: vb.netwinformsbarcodecode39

解决方案


推荐阅读