Supported Formats¶
The following are the supported barcode formats. PRs for other code formats are welcome!
Code 39¶
-
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
-
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¶
New in version 0.8beta1.
-
class
barcode.codex.
Code128
(code, writer=None)¶ Initializes a new Code128 instance. The checksum is added automatically when building the bars.
Parameters: - code : String
Code 128 string without checksum (added automatically).
- writer : barcode.writer Instance
The writer to render the barcode (default: SVGWriter).
-
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.
PZN7 (aka: PZN)¶
EAN-13¶
-
class
barcode.ean.
EuropeanArticleNumber13
(ean, writer=None, no_checksum=False, guardbar=False)¶ Initializes EAN13 object.
Parameters: - ean : String
The ean number as string.
- writer : barcode.writer Instance
The writer to render the barcode (default: SVGWriter).
-
build
()¶ Builds the barcode pattern from self.ean.
Returns: The pattern as string Return type: String
-
calculate_checksum
()¶ Calculates the checksum for EAN13-Code.
Returns: The checksum for self.ean. Return type: Integer
-
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
()¶ Returns an ascii representation of the barcode.
Return type: String
EAN-8¶
-
class
barcode.ean.
EuropeanArticleNumber8
(ean, writer=None, no_checksum=False, guardbar=False)¶ Represents an EAN-8 barcode. See EAN13’s __init__ for details.
Parameters: - ean : String
The ean number as string.
- writer : barcode.writer Instance
The writer to render the barcode (default: SVGWriter).
-
build
()¶ Builds the barcode pattern from self.ean.
Returns: The pattern as string Return type: String
-
get_fullcode
()¶ Returns the full code, encoded in the barcode.
Returns: Full human readable code. Return type: String
JAN¶
-
class
barcode.ean.
JapanArticleNumber
(jan, *args, **kwargs)¶ Initializes JAN barcode.
Parameters: - jan : String
The jan number as string.
- writer : barcode.writer Instance
The writer to render the barcode (default: SVGWriter).
ISBN-13¶
-
class
barcode.isxn.
InternationalStandardBookNumber13
(isbn, writer=None, no_checksum=False, guardbar=False)¶ Initializes new ISBN-13 barcode.
Parameters: - isbn : String
The isbn number as string.
- writer : barcode.writer Instance
The writer to render the barcode (default: SVGWriter).
ISBN-10¶
-
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: - isbn : String
The isbn number as string.
- writer : barcode.writer Instance
The writer to render the barcode (default: SVGWriter).
ISSN¶
-
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: - issn : String
The issn number as string.
- writer : barcode.writer Instance
The writer to render the barcode (default: SVGWriter).
UPC-A¶
-
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
()¶ Builds the barcode pattern from ‘self.upc’
Returns: The pattern as string Return type: str
-
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
()¶ Returns an ascii representation of the barcode.
Return type: str
EAN14¶
-
class
barcode.ean.
EuropeanArticleNumber14
(ean, writer=None, no_checksum=False, guardbar=False)¶ Represents an EAN-14 barcode. See EAN13’s __init__ for details.
Parameters: - ean : String
The ean number as string.
- writer : barcode.writer Instance
The writer to render the barcode (default: SVGWriter).
-
calculate_checksum
()¶ Calculates the checksum for EAN13-Code.
Returns: The checksum for self.ean. Return type: Integer
GS1-128¶
New in version v0.10.0.
-
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
-