{% extends "base.jinja2" %} {% block page_title %}{{ title }}{% endblock %} {% block jumbotron %}

{{page_headline}}

Design your label and print it...

{% endblock %} {% block content %}
%
%
%
%

Printed size w/o margins: ? cm x ? cm

Status

- undefined -
{% endblock %} {% block javascript %} var text = $('#labelText'); function formData() { //var text = $('#labelText').val().replace(/\n/g, "%0A"); var text = $('#labelText').val(); if (text == '') text = ' '; return { text: text, font_family: $('#fontFamily option:selected').text(), font_size: $('#fontSize').val(), label_size: $('#labelSize option:selected').val(), align: $('input[name=fontAlign]:checked').val(), orientation: $('input[name=orientation]:checked').val(), margin_top: $('#marginTop').val(), margin_bottom: $('#marginBottom').val(), margin_left: $('#marginLeft').val(), margin_right: $('#marginRight').val() } } function preview() { if ($('input[name=orientation]:checked').val() == 'standard') { $('.marginsTopBottom').prop('disabled', false).removeAttr('title'); $('.marginsLeftRight').prop('disabled', true).prop('title', 'Only relevant if rotated orientation is selected.'); } else { $('.marginsTopBottom').prop('disabled', true).prop('title', 'Only relevant if standard orientation is selected.'); $('.marginsLeftRight').prop('disabled', false).removeAttr('title'); } $.ajax({ type: 'POST', url: '/api/preview/text?return_format=base64', contentType: 'application/x-www-form-urlencoded; charset=UTF-8', data: formData(), success: function( data ) { $('#previewImg').attr('src', 'data:image/png;base64,' + data); var img = $('#previewImg')[0]; img.onload = function() { $('#labelWidth').html( (img.naturalWidth /300*2.54).toFixed(1)); $('#labelHeight').html((img.naturalHeight/300*2.54).toFixed(1)); }; } }); } function setStatus(data) { if (data['success']) $('#statusPanel').html(''); else $('#statusPanel').html(''); $('#printButton').prop('disabled', false); } function print() { $('#printButton').prop('disabled', true); $('#statusPanel').html(''); $.ajax({ type: 'POST', dataType: 'json', data: formData(), url: '/api/print/text', success: setStatus, error: setStatus }); } preview() {% endblock %}