Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Printer Print using HTML

function PrintElem() {
    var mywindow = window.open('', 'PRINT');
    mywindow.document.write('<html><head><title>Payment Slip</title>');
    mywindow.document.write('</head><body style="text-align:center;font: Georgia, "Times New Roman", Times, serif;background: #fff;font-size: 22pt;margin:20px auto auto 50px;" >');
    mywindow.document.write('<header style="text-align:center; white-space:nowrap;overflow:hidden;line-height: 1em;">' +
    '<p  style="font-size:16pt;white-space:nowrap;overflow:hidden;line-height: 12pt;">Payment Slip</p>' +
    '<p style="font-size:16pt;white-space:nowrap;overflow:hidden;line-height: 1em;">' + $('.mylabelpaymentheader').html() + '</p>' +
'</header>');
    mywindow.document.write('<content style="text-align:center;">' +
    '<table style="margin-left: auto;margin-right: auto;border-collapse: collapse;font-size:16pt;">' +
        '<tr  style="border:1px solid black"><td  style="border:1px solid black">Name:</td><td  style="border:1px solid black">' + $('.lblName').html() + '</td></tr>' +
        '<tr style="border:1px solid black"><td style="border:1px solid black">Address:</td><td style="border:1px solid black">' + $('.lblAddress').html() + '</td></tr>' +
        '<tr  style="border:1px solid black"><td  style="border:1px solid black">Meter No:</td><td  style="border:1px solid black">' + $('.lblMeterNo').html() + '</td></tr>' +
        '<tr  style="border:1px solid black"><td  style="border:1px solid black">Token:</td><td  style="border:1px solid black">' + $('.lblToken').html() + '</td></tr>' +
    '</table>'+

'</content>' +
'<footer>' +
'<hr style="margin-top:30pt;margin-bottom:30pt;">' +
    '<p style="text-align:right;">© pdb</p>' +
'</footer>'+
'');
    mywindow.document.write('</body></html>');
    mywindow.document.close(); // necessary for IE >= 10
    mywindow.focus(); // necessary for IE >= 10*/
    mywindow.print();
    mywindow.close();
    return true;
}
Comment

how to print in html

Javascript
console.log("Text");
Comment

print tag in html

There is nothing as print tag in HTML
Comment

PREVIOUS NEXT
Code Example
Javascript :: what is so called abstractions in javascript 
Javascript :: what is computed property in vue js 
Javascript :: js convert string to number 
Javascript :: ... in javascript 
Javascript :: loop in object 
Javascript :: fibonacci sequence array 
Javascript :: class declaration in javascript 
Javascript :: loop on each character js 
Javascript :: js print 
Javascript :: check if is array javascript 
Javascript :: string charat 
Javascript :: filter bootstrap 
Javascript :: react check if browser is in dark mode 
Javascript :: ternary operator in javascript 
Javascript :: react native 
Javascript :: setting up react on visual studio code 
Javascript :: js date minus 18 years 
Javascript :: object.assign 
Javascript :: sort an array 
Javascript :: regular expression remove spaces 
Javascript :: add role to channel discord.js 
Javascript :: disable a function javascript 
Javascript :: react -native-config 
Javascript :: how to get length in js without using .length method 
Javascript :: how to disable previous date in datepicker using angular 6 
Javascript :: how to create variables using javascript 
Javascript :: quadratic equation in js by function 
Javascript :: how to create my own filter in js 
Javascript :: javascript merge two sorted arrays 
Javascript :: difference between w component did update and did mount 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =