Link to home
Start Free TrialLog in
Avatar of Whing Dela Cruz
Whing Dela CruzFlag for Anguilla

asked on

html print

Hi experts, I'm trying to develop some codes that can call and print automatically to local printer (EPSON TM-U220 Receipt). Is this possible? I'm using google chrome and the codes below is printing but not directly. Any help please!

<html>
<head>

<body>


<button onclick="printData()">Print</button>
<script>
function printData()
{
    var d = "June 12, 2017";
    var a = "My first line";
    var b = "My second line";
    
    myWindow=window.open('','','width=200,height=100');
    myWindow.document.write(d);
    myWindow.document.write(a);
    myWindow.document.write(b);
    //myWindow.focus();
    myWindow.print();
   //EPSON TM-U220 Receipt
}
</script>
</body>
</html>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Chris Jones
Chris Jones
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Whing Dela Cruz

ASKER

Thank you guys, for the comments and info...