سلام
دوستان من سایتی طراحی کردم و میخوام با موبایل متصل به پرینتر از طریق وای فای پرینت بگیرم
من از کد زیر استفاده کردم در سیستم مشکلی وجود نداره و به راحتی پرینت میگیرم اما در موبایل با ارور زیر مواجه میشم
There was a probllem printing the page.please try again.
<div class="input_fields_wrap_delivery" id="invoice">
<button type="submit" class="btn btn-primary" id='btn-print' onclick="printDiv('#invoice');" style="width: 100%;">
</div>
<script>
function printDiv(elem)
{
renderMe($('<div/>').append($(elem).clone()).html());
}
function renderMe(data) {
var mywindow = window.open('', 'invoice-box', 'height=1000,width=1000');
mywindow.document.write('<html><head><title>invoice-box</title>');
mywindow.document.write('<link href="https://roocket.ir/{{ asset('css/select2.min.css') }}" rel="stylesheet">'+
'<link href="https://roocket.ir/{{ asset('css/app.css') }}" rel="stylesheet">'+
'<link href="https://roocket.ir/{{ asset('css/bootstrap-datepicker.min.css') }}" rel="stylesheet">'+
'<link href="https://roocket.ir/{{ asset('css/dataTables.bootstrap.min.css') }}" rel="stylesheet">'+
'<style>\n' +
'body {zoom: 50%;}\n' +
'.table-bordered > thead > tr > th,\n' +
'.table-bordered > tbody > tr > th,\n' +
'.table-bordered > tfoot > tr > th,\n' +
'.table-bordered > thead > tr > td,\n' +
'.table-bordered > tbody > tr > td,\n' +
'.table-bordered > tfoot > tr > td {\n' +
'border: 1px solid #c6c6c6!important;\n' +
'}' +
' @media print{\n' +
' .noprint{\n' +
' display:none;\n' +
' }\n' +
' .onlyprint{' +
' width:100%' +
' display:block;' +
' }\n' +
' }\n' +
'</style>')
mywindow.document.write('</head><body >');
mywindow.document.write(data);
mywindow.document.write('</body></html>');
setTimeout(function () {
mywindow.print();
mywindow.close();
}, 1000)
return true;
}
</script>
ممنون میشم راهنمایی بفرمایید
شاید پاسخ شما همینجا باشد
@majeeddehghan
سلام. من حرفه ای جاوا اسکریپت نیستم ولی منطق میگه وقتی دارید پرینت میگیرید با سیستم پس توی کدتون مشکلی نیست.
مشکل رو در ارتباط بین موبایل و پرینتر پیگیری کنید