Hello,
In asp.net mvc you need to print a certain div only when you press the button.
I want the receipt to print automatically from the printer.
I need to print the receipt directly from the printer without a pop-up screen.
How can I do it?
I want the display in the picture not to open, I want the plug to be removed directly from the printer, I need that, you can do it, it is very important.
<div id="yazilanalana">
<h2>merhaba</h2>
</div>
<h1>hsdasdas</h1>
<button onclick="yazdir()">Fiş Yazdır</button>
<script>
function yazdir() {
var printContent = document.getElementById("yazilanalana").innerHTML;
var originalContent = document.body.innerHTML;
document.body.innerHTML = printContent;
window.print();
document.body.innerHTML = originalContent;
}
</script>