| Server IP : 121.121.20.254 / Your IP : 216.73.216.202 Web Server : Microsoft-IIS/10.0 System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64 User : IUSR ( 0) PHP Version : 8.3.28 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/inetpub/wwwroot/CAFE1/wp-content/plugins/woocommerce-openpos-printer/printer/ |
Upload File : |
<?php
function current_url(){
if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on')
$link = "https";
else
$link = "http";
// Here append the common URL characters.
$link .= "://";
// Append the host(domain name, ip) to the URL.
$link .= $_SERVER['HTTP_HOST'];
// Append the requested resource location to the URL
$link .= $_SERVER['REQUEST_URI'];
return $link;
}
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>OpenposPrinter</title>
<base href="<?php echo current_url(); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<link rel="stylesheet" href="styles.css"></head>
<body>
<a href="javascript:void(0);" id="click-here">Click here To Print</a>
<a href="javascript:void(0);" id="click-request-usb">Request USB</a>
<script type="text/javascript">
$(document).ready(function(){
$('#click-here').click(function(){
let receipt = new Array();
receipt.push({
command: 'setInverse',
value: false //boolean
});
receipt.push({
command: 'setBold',
value: true //boolean
});
receipt.push({
command: 'setJustification',
value: 'center' //value left\center\right
});
receipt.push({
command: 'setSize',
value: 'normal' //value normal\large
});
receipt.push({
command: 'setUnderline',
value: false //boolean
});
receipt.push({
command: 'writeLine',
text: 'OpenPOS - Best Point Of Sale' // text
});
receipt.push({
command: 'feed',
lineCount: 1 //number
});
receipt.push({
command: 'cut',
cutType: '' //cutType fill|partial
});
receipt.push({
command: 'flush'
});
let paymentFired = new CustomEvent("op.printer.print", {
"detail": receipt
});
window.dispatchEvent(paymentFired);
});
$('#click-request-usb').click(function(){
let paymentFired = new CustomEvent("op.printer.request_usb", {
"detail": {}
});
window.dispatchEvent(paymentFired);
});
function bindEvent(element, eventName, eventHandler) {
if (element.addEventListener) {
element.addEventListener(eventName, eventHandler, false);
} else if (element.attachEvent) {
element.attachEvent('on' + eventName, eventHandler);
}
}
bindEvent(window, 'message', function (e) {
let print_event = e.data;
let print_command = print_event['command'] ? print_event['command'] : '';
let print_data = print_event['print_data'] ? print_event['print_data'] : [];
if(print_command == 'print_now')
{
let paymentFired = new CustomEvent("op.printer.print", {
"detail": print_data
});
window.dispatchEvent(paymentFired);
}
});
});
</script>
<app-op-printer></app-op-printer>
<script src="runtime-es2015.js" type="module"></script><script src="runtime-es5.js" nomodule defer></script><script src="polyfills-es5.js" nomodule defer></script><script src="polyfills-es2015.js" type="module"></script><script src="main-es2015.js" type="module"></script><script src="main-es5.js" nomodule defer></script></body>
</html>