I'm trying to get an alphanumeric-encoded barcode using the viivakoodi
library. I got the barcode which I needed but I'm not able to display it in my HTML page using Jinja2. Here's my code:
import barcode
from StringIO import StringIO
encoding_std = barcode.get_barcode_class('code128')
ean = encoding_std('Test123')
fp = StringIO()
ean.write(fp)
encoded_output = fp.getvalue()
fp.close()
I'm currently storing the barcode as SVG and I'm not able to display that in the HTML page. Using {{ encoded_ouput | safe }}
in the HTML page to display the barcode does not show me the results:
<div class="row border-bottom no-margin" style="height: 15%">
<div class="float-left border-right"
style="width: 100%; padding: 5px; height: 100%;font-family:arial">
<p style="font-weight:bold; margin-bottom: 0; font-family:arial; font-size:13px">
<b>Generated Barcode Space:</b></p><b>
{{ encoded_output | safe }}
</b></div>
</div>
Or any Jinja2 filters are there to get the SVG?