mirror of
https://github.com/pklaus/brother_ql_web.git
synced 2024-05-25 11:56:53 +03:00
State width&height of label in cm
This commit is contained in:
parent
7ed5c077d9
commit
7935fd0940
|
@ -95,6 +95,7 @@
|
||||||
<fieldset class="form-group">
|
<fieldset class="form-group">
|
||||||
<label for="previewImg">Label Preview:</label><br />
|
<label for="previewImg">Label Preview:</label><br />
|
||||||
<img id="previewImg" style="border: 1px solid #444; max-height: 350px; width: auto; max-width: 100%; margin-bottom: 10px;"/>
|
<img id="previewImg" style="border: 1px solid #444; max-height: 350px; width: auto; max-width: 100%; margin-bottom: 10px;"/>
|
||||||
|
<p>Printed size w/o margins: <span id="labelWidth">?</span> cm x <span id="labelHeight">?</span> cm</p>
|
||||||
<button id="printButton" type="button" class="btn btn-primary btn-block btn-lg" onClick="print()">
|
<button id="printButton" type="button" class="btn btn-primary btn-block btn-lg" onClick="print()">
|
||||||
<span class="glyphicon glyphicon-print" aria-hidden="true"></span> Print
|
<span class="glyphicon glyphicon-print" aria-hidden="true"></span> Print
|
||||||
</button>
|
</button>
|
||||||
|
@ -136,6 +137,11 @@ function preview() {
|
||||||
data: formData(),
|
data: formData(),
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
$('#previewImg').attr('src', 'data:image/png;base64,' + 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));
|
||||||
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user