I am trying to use the Epson TM-T20II (thermal printer) through a web page. I made the necessary configuration, and the printer works fine on my network using this software. So I downloaded the SDK to print JS epos and tried to run this sample code:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>TITLE</title>
<script type="text/javascript" src="../ePOS-Print_SDK/ePOS-Print_SDK_150729E/JavaScript/epos-print-5.0.0.js"></script>
<script type="text/javascript">
function buildMessage() {
var builder = new epson.ePOSBuilder();
builder.addTextLang('en')
builder.addTextSmooth(true);
builder.addTextFont(builder.FONT_A);
builder.addTextSize(3, 3);
builder.addText('Hello,\tWorld!\n');
builder.addCut(builder.CUT_FEED);
var request = builder.toString();
var address = 'http://192.168.1.65/cgi-bin/epos/service.cgi?devid=99&timeout=1000';
var epos = new epson.ePOSPrint(address);
epos.onreceive = function (res) {
if (!res.success) {
alert('A print error occurred');
}
}
epos.send(request);
}
</script>
</head>
<body>
<button onclick='buildMessage()'>Run</button>
</body>
</html>
For the devid parameter, I tried "local_printer", which is the name of the device, then I saw in the configuration panel that the printer ID is 99. However, it does not work, I got the 405th method that does not resolve the status code in the cgi request .
Any tips? Thanks in advance.
EDIT:
, , CORS. , , "Access-Control-Allow-Origin". , ?