.. index:: writer, writer_options

python-barcode Writer
=====================

Common Writer Options
---------------------

All writer take the following options (specified as keyword arguments
to `Barcode.save(filename, options)` or set via
`Writer.set_options(options)`, where `options` is a dictionary where keys are option names and values are option
values to be set).

.. note::
   See the documentation of the specific writer for special options,
   only available for this writer.

Common Options:
~~~~~~~~~~~~~~~

: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_path:
    Path to the font file to be used. Defaults to **DejaVuSansMono** (which
    is bundled with this package).

: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**.

.. versionadded:: 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.

Writers
-------

.. toctree::
   :maxdepth: 2

   svg
   image
   create_writer

API (autogenerated)
-------------------

.. automodule:: barcode.writer
   :members:
