add label code in tag
This commit is contained in:
parent
999cd3e26c
commit
05b4353cc4
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -12,7 +12,7 @@ function qr_draw(url) {
|
||||||
height: 128,
|
height: 128,
|
||||||
colorDark : "#000000",
|
colorDark : "#000000",
|
||||||
colorLight : "#ffffff",
|
colorLight : "#ffffff",
|
||||||
correctLevel : QRCode.CorrectLevel.H
|
correctLevel : QRCode.CorrectLevel.Q
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,10 +51,19 @@ function change_size() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function printpdf() {
|
function printpdf() {
|
||||||
|
var border = 2;
|
||||||
var height = parseInt($("#height-tag").val());
|
var height = parseInt($("#height-tag").val());
|
||||||
var width = parseInt($("#width-tag").val());
|
var width = parseInt($("#width-tag").val());
|
||||||
var doc = new jsPDF('l', 'mm', [width, height]);
|
var tag = $("#tag").text();
|
||||||
//var doc = new jsPDF('l', 'mm', [62, 29]);
|
var pdf = new jsPDF('l', 'mm', [width, height]);
|
||||||
doc.addHTML($("#print"), 2, 2);
|
var imgData = $('#qrcode img').attr("src");
|
||||||
doc.save('Tags.pdf');
|
img_side = Math.min(height, width) - 2*border;
|
||||||
|
max_tag_side = (Math.max(height, width)/2) + border;
|
||||||
|
if (max_tag_side < img_side) {
|
||||||
|
max_tag_side = img_side+ 2*border;
|
||||||
|
};
|
||||||
|
min_tag_side = (Math.min(height, width)/2) + border;
|
||||||
|
pdf.addImage(imgData, 'PNG', border, border, img_side, img_side);
|
||||||
|
pdf.text(tag, max_tag_side, min_tag_side);
|
||||||
|
pdf.save('Tags.pdf');
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
<div id="qrcode"></div>
|
<div id="qrcode"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<div style="padding-top: 55px"><b>{{ tag.id }}</b></div>
|
<div style="padding-top: 55px"><b id="tag">{{ tag.id }}</b></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -109,7 +109,7 @@
|
||||||
</section>
|
</section>
|
||||||
<script src="{{ url_for('static', filename='js/jquery-3.6.0.min.js') }}"></script>
|
<script src="{{ url_for('static', filename='js/jquery-3.6.0.min.js') }}"></script>
|
||||||
<script src="{{ url_for('static', filename='js/qrcode.js') }}"></script>
|
<script src="{{ url_for('static', filename='js/qrcode.js') }}"></script>
|
||||||
<script src="{{ url_for('static', filename='js/pdf.min.js') }}"></script>
|
<script src="{{ url_for('static', filename='js/jspdf.min.js') }}"></script>
|
||||||
<script src="{{ url_for('static', filename='js/print.pdf.js') }}"></script>
|
<script src="{{ url_for('static', filename='js/print.pdf.js') }}"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
qr_draw("{{url_for('inventory.devices.device_details', id=tag.device.devicehub_id, _external=True)}}");
|
qr_draw("{{url_for('inventory.devices.device_details', id=tag.device.devicehub_id, _external=True)}}");
|
||||||
|
|
Reference in New Issue