-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestprinter.php
37 lines (35 loc) · 1.25 KB
/
testprinter.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<html>
<head>
<title>Menampilkan List Printer</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script type="text/javascript">
function cetak(){
var printer = $("#printer").val();
$.ajax({
url : "cetak_langsung.php",
type: "POST",
data : "nama_printer="+printer,
success: function(data, textStatus, jqXHR)
{
alert('Data Sudah DIcetak Ke Printer : '+printer)
}
});
}
</script>
</head>
<body>
Silahkan Pilih Printer :
<?php
$getprt = printer_list(PRINTER_ENUM_LOCAL);
$printers = serialize($getprt);
$printers = unserialize($printers);
//Menampilkan List Printer
echo '<select name="printers" id="printer">';
foreach ($printers as $PrintDest)
echo "<option value='" . $PrintDest["NAME"] . "'>" . explode(",", $PrintDest["DESCRIPTION"])[1] . "</option>";
echo '</select>';
?>
<br>
<button type="submit" onClick="cetak()">Cetak Data</button>
</body>
</html>