Supported Formats

The following are the supported barcode formats. PRs for other code formats are welcome!

Codabar

digraph inheritance32b61196cf { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "Barcode" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled"]; "CODABAR" [URL="supported-formats.html#barcode.codabar.CODABAR",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Initializes a new CODABAR instance."]; "Barcode" -> "CODABAR" [arrowsize=0.5,style="setlinewidth(0.5)"]; }
class barcode.codabar.CODABAR(code, writer=None, narrow=2, wide=5)

Initializes a new CODABAR instance.

Parameters:
codeString

Codabar (NW-7) string that matches [ABCD][0-9$:/.+-]+[ABCD]

writerbarcode.writer Instance

The writer to render the barcode (default: SVGWriter).

narrow: Integer

Width of the narrow elements (default: 2)

wide: Integer

Width of the wide elements (default: 5) wide/narrow must be in the range 2..3

build() list[str]

Return a single-element list with a string encoding the barcode.

Typically the string consists of 1s and 0s, although it can contain other characters such as G for guard lines (e.g. in EAN13).

get_fullcode()

Returns the full code, encoded in the barcode.

Returns:

Full human readable code.

Return type:

String

Code 39

digraph inheritancec5dca429ab { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "Barcode" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled"]; "Code39" [URL="supported-formats.html#barcode.codex.Code39",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A Code39 barcode implementation"]; "Barcode" -> "Code39" [arrowsize=0.5,style="setlinewidth(0.5)"]; }
class barcode.codex.Code39(code: str, writer=None, add_checksum: bool = True)

A Code39 barcode implementation

Parameters:
  • code – Code 39 string without * and without checksum.

  • writer – A barcode.writer instance used to render the barcode (default: SVGWriter).

  • add_checksum – Add the checksum to code or not

build() list[str]

Return a single-element list with a string encoding the barcode.

Typically the string consists of 1s and 0s, although it can contain other characters such as G for guard lines (e.g. in EAN13).

get_fullcode() str
Returns:

The full code as it will be encoded.

render(writer_options=None, text=None)

Renders the barcode using self.writer.

Parameters:
  • writer_options – Options for self.writer, see writer docs for details.

  • text – Text to render under the barcode.

Returns:

Output of the writers render method.

Code 128

Added in version 0.8beta1.

digraph inheritance3d3dd17988 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "Barcode" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled"]; "Code128" [URL="supported-formats.html#barcode.codex.Code128",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Initializes a new Code128 instance. The checksum is added automatically"]; "Barcode" -> "Code128" [arrowsize=0.5,style="setlinewidth(0.5)"]; }
class barcode.codex.Code128(code: str, writer=None)

Initializes a new Code128 instance. The checksum is added automatically when building the bars.

Parameters:
codeString

Code 128 string without checksum (added automatically).

writerbarcode.writer Instance

The writer to render the barcode (default: SVGWriter).

build() list[str]

Return a single-element list with a string encoding the barcode.

Typically the string consists of 1s and 0s, although it can contain other characters such as G for guard lines (e.g. in EAN13).

get_fullcode() str

Returns the full code, encoded in the barcode.

Returns:

Full human readable code.

Return type:

String

render(writer_options=None, text=None)

Renders the barcode using self.writer.

Parameters:
  • writer_options – Options for self.writer, see writer docs for details.

  • text – Text to render under the barcode.

Returns:

Output of the writers render method.

PZN (aka: PZN7)

digraph inheritanceaaa32ee26b { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "Barcode" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled"]; "Code39" [URL="supported-formats.html#barcode.codex.Code39",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A Code39 barcode implementation"]; "Barcode" -> "Code39" [arrowsize=0.5,style="setlinewidth(0.5)"]; "PZN7" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Initializes new German number for pharmaceutical products."]; "Code39" -> "PZN7" [arrowsize=0.5,style="setlinewidth(0.5)"]; }
barcode.codex.PZN

alias of PZN7

EAN-13

digraph inheritance790c55498e { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "Barcode" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled"]; "EuropeanArticleNumber13" [URL="supported-formats.html#barcode.ean.EuropeanArticleNumber13",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Initializes EAN13 object."]; "Barcode" -> "EuropeanArticleNumber13" [arrowsize=0.5,style="setlinewidth(0.5)"]; "EuropeanArticleNumber13WithGuard" [URL="supported-formats.html#barcode.ean.EuropeanArticleNumber13WithGuard",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A shortcut to EAN-13 with ``guardbar=True``."]; "EuropeanArticleNumber13" -> "EuropeanArticleNumber13WithGuard" [arrowsize=0.5,style="setlinewidth(0.5)"]; }
class barcode.ean.EuropeanArticleNumber13(ean: str, writer=None, no_checksum=False, guardbar=False)

Initializes EAN13 object.

Parameters:
  • ean – The ean number as string. If the value is too long, it is trimmed.

  • writer – The writer to render the barcode (default: SVGWriter).

  • no_checksum – Don’t calculate the checksum. Use the provided input instead.

build() list[str]

Builds the barcode pattern from self.ean.

Returns:

The pattern as string

Return type:

List containing the string as a single element

calculate_checksum(value: str | None = None) int

Calculates and returns the checksum for EAN13-Code.

Calculates the checksum for the supplied value (if any) or for this barcode’s internal self.ean property.

get_fullcode() str

Returns the full code, encoded in the barcode.

Returns:

Full human readable code.

Return type:

String

render(writer_options=None, text=None)

Renders the barcode using self.writer.

Parameters:
  • writer_options – Options for self.writer, see writer docs for details.

  • text – Text to render under the barcode.

Returns:

Output of the writers render method.

to_ascii() str

Returns an ascii representation of the barcode.

Return type:

String

class barcode.ean.EuropeanArticleNumber13WithGuard(ean, writer=None, no_checksum=False, guardbar=True)

A shortcut to EAN-13 with guardbar=True.

EAN-8

digraph inheritanceafa7de0135 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "Barcode" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled"]; "EuropeanArticleNumber13" [URL="supported-formats.html#barcode.ean.EuropeanArticleNumber13",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Initializes EAN13 object."]; "Barcode" -> "EuropeanArticleNumber13" [arrowsize=0.5,style="setlinewidth(0.5)"]; "EuropeanArticleNumber8" [URL="supported-formats.html#barcode.ean.EuropeanArticleNumber8",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Represents an EAN-8 barcode. See EAN13's __init__ for details."]; "EuropeanArticleNumber13" -> "EuropeanArticleNumber8" [arrowsize=0.5,style="setlinewidth(0.5)"]; "EuropeanArticleNumber8WithGuard" [URL="supported-formats.html#barcode.ean.EuropeanArticleNumber8WithGuard",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A shortcut to EAN-8 with ``guardbar=True``."]; "EuropeanArticleNumber8" -> "EuropeanArticleNumber8WithGuard" [arrowsize=0.5,style="setlinewidth(0.5)"]; }
class barcode.ean.EuropeanArticleNumber8(ean: str, writer=None, no_checksum=False, guardbar=False)

Represents an EAN-8 barcode. See EAN13’s __init__ for details.

Parameters:
eanString

The ean number as string.

writerbarcode.writer Instance

The writer to render the barcode (default: SVGWriter).

build() list[str]

Builds the barcode pattern from self.ean.

Returns:

A list containing the string as a single element

get_fullcode()

Returns the full code, encoded in the barcode.

Returns:

Full human readable code.

Return type:

String

class barcode.ean.EuropeanArticleNumber8WithGuard(ean, writer=None, no_checksum=False, guardbar=True)

A shortcut to EAN-8 with guardbar=True.

EAN-14

digraph inheritancef1a282d3b4 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "Barcode" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled"]; "EuropeanArticleNumber13" [URL="supported-formats.html#barcode.ean.EuropeanArticleNumber13",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Initializes EAN13 object."]; "Barcode" -> "EuropeanArticleNumber13" [arrowsize=0.5,style="setlinewidth(0.5)"]; "EuropeanArticleNumber14" [URL="supported-formats.html#id0",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Represents an EAN-14 barcode. See EAN13's __init__ for details."]; "EuropeanArticleNumber13" -> "EuropeanArticleNumber14" [arrowsize=0.5,style="setlinewidth(0.5)"]; }
class barcode.ean.EuropeanArticleNumber14(ean: str, writer=None, no_checksum=False, guardbar=False)

Represents an EAN-14 barcode. See EAN13’s __init__ for details.

Parameters:
  • ean – The ean number as string.

  • writer – The writer to render the barcode (default: SVGWriter).

  • no_checksum – Don’t calculate the checksum. Use the provided input instead.

calculate_checksum(value: str | None = None) int

Calculates and returns the checksum for EAN14-Code.

Calculates the checksum for the supplied value (if any) or for this barcode’s internal self.ean property.

JAN

digraph inheritance0772130855 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "Barcode" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled"]; "EuropeanArticleNumber13" [URL="supported-formats.html#barcode.ean.EuropeanArticleNumber13",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Initializes EAN13 object."]; "Barcode" -> "EuropeanArticleNumber13" [arrowsize=0.5,style="setlinewidth(0.5)"]; "JapanArticleNumber" [URL="supported-formats.html#barcode.ean.JapanArticleNumber",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Initializes JAN barcode."]; "EuropeanArticleNumber13" -> "JapanArticleNumber" [arrowsize=0.5,style="setlinewidth(0.5)"]; }
class barcode.ean.JapanArticleNumber(jan, *args, **kwargs)

Initializes JAN barcode.

Parameters:
janString

The jan number as string.

writerbarcode.writer Instance

The writer to render the barcode (default: SVGWriter).

ISBN-13 (aka: GS1, ISBN)

digraph inheritance9a80af39be { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "Barcode" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled"]; "EuropeanArticleNumber13" [URL="supported-formats.html#barcode.ean.EuropeanArticleNumber13",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Initializes EAN13 object."]; "Barcode" -> "EuropeanArticleNumber13" [arrowsize=0.5,style="setlinewidth(0.5)"]; "InternationalStandardBookNumber13" [URL="supported-formats.html#barcode.isxn.InternationalStandardBookNumber13",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Initializes new ISBN-13 barcode."]; "EuropeanArticleNumber13" -> "InternationalStandardBookNumber13" [arrowsize=0.5,style="setlinewidth(0.5)"]; }
class barcode.isxn.InternationalStandardBookNumber13(isbn, writer=None, no_checksum=False, guardbar=False)

Initializes new ISBN-13 barcode.

Parameters:
isbnString

The isbn number as string.

writerbarcode.writer Instance

The writer to render the barcode (default: SVGWriter).

ISBN-10

digraph inheritance39e6fb2772 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "Barcode" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled"]; "EuropeanArticleNumber13" [URL="supported-formats.html#barcode.ean.EuropeanArticleNumber13",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Initializes EAN13 object."]; "Barcode" -> "EuropeanArticleNumber13" [arrowsize=0.5,style="setlinewidth(0.5)"]; "InternationalStandardBookNumber10" [URL="supported-formats.html#barcode.isxn.InternationalStandardBookNumber10",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Initializes new ISBN-10 barcode. This code is rendered as EAN-13 by"]; "InternationalStandardBookNumber13" -> "InternationalStandardBookNumber10" [arrowsize=0.5,style="setlinewidth(0.5)"]; "InternationalStandardBookNumber13" [URL="supported-formats.html#barcode.isxn.InternationalStandardBookNumber13",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Initializes new ISBN-13 barcode."]; "EuropeanArticleNumber13" -> "InternationalStandardBookNumber13" [arrowsize=0.5,style="setlinewidth(0.5)"]; }
class barcode.isxn.InternationalStandardBookNumber10(isbn, writer=None)

Initializes new ISBN-10 barcode. This code is rendered as EAN-13 by prefixing it with 978.

Parameters:
isbnString

The isbn number as string.

writerbarcode.writer Instance

The writer to render the barcode (default: SVGWriter).

ISSN

digraph inheritanceb66ba4461a { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "Barcode" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled"]; "EuropeanArticleNumber13" [URL="supported-formats.html#barcode.ean.EuropeanArticleNumber13",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Initializes EAN13 object."]; "Barcode" -> "EuropeanArticleNumber13" [arrowsize=0.5,style="setlinewidth(0.5)"]; "InternationalStandardSerialNumber" [URL="supported-formats.html#barcode.isxn.InternationalStandardSerialNumber",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Initializes new ISSN barcode. This code is rendered as EAN-13"]; "EuropeanArticleNumber13" -> "InternationalStandardSerialNumber" [arrowsize=0.5,style="setlinewidth(0.5)"]; }
class barcode.isxn.InternationalStandardSerialNumber(issn, writer=None)

Initializes new ISSN barcode. This code is rendered as EAN-13 by prefixing it with 977 and adding 00 between code and checksum.

Parameters:
issnString

The issn number as string.

writerbarcode.writer Instance

The writer to render the barcode (default: SVGWriter).

UPC-A

digraph inheritance9dd61ec76e { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "Barcode" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled"]; "UniversalProductCodeA" [URL="supported-formats.html#barcode.upc.UniversalProductCodeA",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Universal Product Code (UPC) barcode."]; "Barcode" -> "UniversalProductCodeA" [arrowsize=0.5,style="setlinewidth(0.5)"]; }
class barcode.upc.UniversalProductCodeA(upc, writer=None, make_ean=False)

Universal Product Code (UPC) barcode.

UPC-A consists of 12 numeric digits.

Initializes new UPC-A barcode.

Parameters:
  • upc (str) – The upc number as string.

  • writer – barcode.writer instance. The writer to render the barcode (default: SVGWriter).

  • make_ean (bool) – Indicates if a leading zero should be added to the barcode. This converts the UPC into a valid European Article Number (EAN).

build() list[str]

Builds the barcode pattern from ‘self.upc’

Returns:

The pattern as string

Return type:

List containing the string as a single element

calculate_checksum()

Calculates the checksum for UPCA/UPC codes

Returns:

The checksum for ‘self.upc’

Return type:

int

get_fullcode()

Returns the full code, encoded in the barcode.

Returns:

Full human readable code.

Return type:

String

render(writer_options=None, text=None)

Renders the barcode using self.writer.

Parameters:
  • writer_options – Options for self.writer, see writer docs for details.

  • text – Text to render under the barcode.

Returns:

Output of the writers render method.

to_ascii() str

Returns an ascii representation of the barcode.

Return type:

str

EAN14 (aka: GTIN)

digraph inheritancef1a282d3b4 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "Barcode" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled"]; "EuropeanArticleNumber13" [URL="supported-formats.html#barcode.ean.EuropeanArticleNumber13",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Initializes EAN13 object."]; "Barcode" -> "EuropeanArticleNumber13" [arrowsize=0.5,style="setlinewidth(0.5)"]; "EuropeanArticleNumber14" [URL="supported-formats.html#id0",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Represents an EAN-14 barcode. See EAN13's __init__ for details."]; "EuropeanArticleNumber13" -> "EuropeanArticleNumber14" [arrowsize=0.5,style="setlinewidth(0.5)"]; }
class barcode.ean.EuropeanArticleNumber14(ean: str, writer=None, no_checksum=False, guardbar=False)

Represents an EAN-14 barcode. See EAN13’s __init__ for details.

Parameters:
  • ean – The ean number as string.

  • writer – The writer to render the barcode (default: SVGWriter).

  • no_checksum – Don’t calculate the checksum. Use the provided input instead.

calculate_checksum(value: str | None = None) int

Calculates and returns the checksum for EAN14-Code.

Calculates the checksum for the supplied value (if any) or for this barcode’s internal self.ean property.

GS1-128

Added in version v0.10.0.

digraph inheritancebbcc2a8a86 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "Barcode" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled"]; "Code128" [URL="supported-formats.html#barcode.codex.Code128",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Initializes a new Code128 instance. The checksum is added automatically"]; "Barcode" -> "Code128" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Gs1_128" [URL="supported-formats.html#barcode.codex.Gs1_128",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="following the norm, a gs1-128 barcode is a subset of code 128 barcode,"]; "Code128" -> "Gs1_128" [arrowsize=0.5,style="setlinewidth(0.5)"]; }
class barcode.codex.Gs1_128(code, writer=None)

following the norm, a gs1-128 barcode is a subset of code 128 barcode, it can be generated by prepending the code with the FNC1 character https://en.wikipedia.org/wiki/GS1-128 https://www.gs1-128.info/

get_fullcode()

Returns the full code, encoded in the barcode.

Returns:

Full human readable code.

Return type:

String

ITF

Added in version 0.8.0.

digraph inheritance681c446587 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "Barcode" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled"]; "ITF" [URL="supported-formats.html#barcode.itf.ITF",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Initializes a new ITF instance."]; "Barcode" -> "ITF" [arrowsize=0.5,style="setlinewidth(0.5)"]; }
class barcode.itf.ITF(code, writer=None, narrow=2, wide=5)

Initializes a new ITF instance.

Parameters:
codeString

ITF (Interleaved 2 of 5) numeric string

writerbarcode.writer Instance

The writer to render the barcode (default: SVGWriter).

narrow: Integer

Width of the narrow elements (default: 2)

wide: Integer

Width of the wide elements (default: 5) wide/narrow must be in the range 2..3

build() list[str]

Return a single-element list with a string encoding the barcode.

Typically the string consists of 1s and 0s, although it can contain other characters such as G for guard lines (e.g. in EAN13).

get_fullcode()

Returns the full code, encoded in the barcode.

Returns:

Full human readable code.

Return type:

String

render(writer_options, text=None)

Renders the barcode using self.writer.

Parameters:
  • writer_options – Options for self.writer, see writer docs for details.

  • text – Text to render under the barcode.

Returns:

Output of the writers render method.

UPCA (aka UPC)

digraph inheritancebd4f3d95a0 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "Barcode" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled"]; "UniversalProductCodeA" [URL="supported-formats.html#barcode.upc.UniversalProductCodeA",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Universal Product Code (UPC) barcode."]; "Barcode" -> "UniversalProductCodeA" [arrowsize=0.5,style="setlinewidth(0.5)"]; }
barcode.upc.UPCA

alias of UniversalProductCodeA