All writer take the following options (specified as keyword arguments to Barcode.save(filename, option=value) or set via Writer.set_options(option=value)).
Note
See the documentation of the specific writer for special options, only available for this writer.
module_width: | The width of one barcode module in mm as float. Defaults to 0.2. |
---|---|
module_height: | The height of the barcode modules in mm as float. Defaults to 15.0. |
quiet_zone: | Distance on the left and on the right from the border to the first (last) barcode module in mm as float. Defaults to 6.5. |
font_size: | Font size of the text under the barcode in pt as integer. Defaults to 10. |
text_distance: | Distance between the barcode and the text under it in mm as float. Defaults to 5.0. |
background: | The background color of the created barcode as string. Defaults to white. |
foreground: | The foreground and text color of the created barcode as string. Defaults to black. |
New in version 0.6.
center_text: | If true (the default) the text is centered under the barcode else left aligned. |
---|
Note
Some barcode classes change the above defaults to fit in some kind of specification.
Baseclass for all writers.
Initializes the basic writer options. Childclasses can add more attributes and can set them directly or using self.set_options(option=value).
Parameters : |
|
---|
Calculates the size of the barcode in pixel.
Parameters : |
|
---|---|
Returns: | Width and height of the barcode in pixel. |
Return type: | Tuple |
Register one of the three callbacks if not given at instance creation.
Parameters : |
|
---|
Renders the barcode to whatever the inheriting writer provides, using the registered callbacks.
Parameters : |
|
---|
Saves the rendered output to filename.
Parameters : |
|
---|---|
Returns: | The full filename with extension. |
Return type: | String |
Sets the given options as instance attributes (only if they are known).
Parameters : |
|
---|---|
Return type: | None |