try printpdf
This commit is contained in:
parent
2840c5c21e
commit
999cd3e26c
|
@ -3,11 +3,10 @@ $(document).ready(function() {
|
||||||
$("#printerType").on("change", change_size);
|
$("#printerType").on("change", change_size);
|
||||||
change_size();
|
change_size();
|
||||||
load_size();
|
load_size();
|
||||||
// printpdf();
|
|
||||||
})
|
})
|
||||||
|
|
||||||
function qr_draw(url) {
|
function qr_draw(url) {
|
||||||
var qrcode = new QRCode(document.getElementById("qrcode"), {
|
var qrcode = new QRCode($("#qrcode")[0], {
|
||||||
text: url,
|
text: url,
|
||||||
width: 128,
|
width: 128,
|
||||||
height: 128,
|
height: 128,
|
||||||
|
@ -52,7 +51,10 @@ function change_size() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function printpdf() {
|
function printpdf() {
|
||||||
var height = $("#height-tag").val();
|
var height = parseInt($("#height-tag").val());
|
||||||
var width = $("#width-tag").val();
|
var width = parseInt($("#width-tag").val());
|
||||||
console.log(height);
|
var doc = new jsPDF('l', 'mm', [width, height]);
|
||||||
|
//var doc = new jsPDF('l', 'mm', [62, 29]);
|
||||||
|
doc.addHTML($("#print"), 2, 2);
|
||||||
|
doc.save('Tags.pdf');
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,6 +112,6 @@
|
||||||
<script src="{{ url_for('static', filename='js/pdf.min.js') }}"></script>
|
<script src="{{ url_for('static', filename='js/pdf.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)}}");
|
||||||
</script>
|
</script>
|
||||||
{% endblock main %}
|
{% endblock main %}
|
||||||
|
|
Reference in a new issue