python-barcode icon indicating copy to clipboard operation
python-barcode copied to clipboard

Vertical white space is not configurable

Open leecbaker opened this issue 6 years ago • 1 comments

There's a fixed 1 unit of white space added above and below bar codes. I'd love to be able to adjust this; seems like it would be great as a writer option.

Should be simple and quick to implement.

leecbaker avatar Mar 29 '19 10:03 leecbaker

The extra space is added due to the 2.0 offset in line https://github.com/WhyNotHugo/python-barcode/blob/83a0b4e87755f8dcb22c9cf35c52f6f3ae7a6993/barcode/writer.py#L116 Because of the offset, there is a hardcoded half offset in https://github.com/WhyNotHugo/python-barcode/blob/83a0b4e87755f8dcb22c9cf35c52f6f3ae7a6993/barcode/writer.py#L205

I believe this could be a new Writer option (extra_vertical_space) so I don't break backward compatibility.

Edit: @WhyNotHugo would this solution be accepted?

marcoaaguiar avatar Jun 20 '21 16:06 marcoaaguiar