← 返回命令列表

Linux command

barcode 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Generate a barcode as PostScript

barcode -b "[data]" -o [output.ps]

Generate a barcode as EPS

barcode -b "[data]" -e EPS -o [output.eps]

Generate Code 39 barcode

barcode -e code39 -b "[DATA123]" -o [output.ps]

Generate EAN-13 barcode

barcode -e ean -b "[5901234123457]" -o [output.ps]

Generate Code 128 barcode

barcode -e code128 -b "[data]" -o [output.ps]

Generate barcode without text label

barcode -b "[data]" -n -o [output.ps]

Set custom dimensions

barcode -b "[data]" -g [100x50] -o [output.ps]

说明

barcode is a GNU utility that generates barcodes in various formats from textual data. It produces PostScript or EPS output that can be printed directly, converted to other formats, or embedded in documents. The tool supports all major 1D barcode symbologies used in retail, logistics, and inventory management. Each encoding has specific rules for valid characters and optional check digits. The tool automatically calculates check digits for formats that require them. Output can be customized with different sizes, margins, and label options. Table mode allows generating sheets of labels for batch printing.

参数

-b _string_
Data to encode in the barcode.
-e _encoding_
Barcode encoding type (ean, upc, code39, code128, etc.).
-o _file_
Output file (default: stdout).
-g _WxH_
Barcode geometry (width x height in points).
-n
No text; suppress human-readable label below barcode.
-t _WxH_
Table mode: generate multiple barcodes per page.
-m _margin_
Margin size around barcode.
-p _pagesize_
Page size (a4, letter, etc.).
-u _unit_
Unit for dimensions (mm, in, pt).
-E
Output as EPS (Encapsulated PostScript).
-P
Output as PCL (for HP printers).

FAQ

What is the barcode command used for?

barcode is a GNU utility that generates barcodes in various formats from textual data. It produces PostScript or EPS output that can be printed directly, converted to other formats, or embedded in documents. The tool supports all major 1D barcode symbologies used in retail, logistics, and inventory management. Each encoding has specific rules for valid characters and optional check digits. The tool automatically calculates check digits for formats that require them. Output can be customized with different sizes, margins, and label options. Table mode allows generating sheets of labels for batch printing.

How do I run a basic barcode example?

Run `barcode -b "[data]" -o [output.ps]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -b _string_ do in barcode?

Data to encode in the barcode.