In der Druckvorschau wird zusätzlichen Speicherplatz für
,

,

-Tag in der Print -Vorschau hinzugefügtCSS

CSS verstehen
Anonymous
 In der Druckvorschau wird zusätzlichen Speicherplatz für
,

,

-Tag in der Print -Vorschau hinzugefügt

Post by Anonymous »

Ich versuche, eine Rechnung zu generieren und sie mithilfe der Druckschaltfläche zu drucken. Dies ist eine Druckvorschau und zusätzlichen White -Space wird vor hinzugefügt, bevor und nach wie im Bild gezeigt gezeigt.

Code: Select all

// Function to handle actual printing (this will only be called if validation passes)
function printThermalBill() {
// Existing code to print the bill
const billContent = document.getElementById('billDisplay').innerHTML;
const printWindow = window.open('', '', 'width=600,height=600');
printWindow.document.write(`
Print Bill
${billContent}

`);
printWindow.print();
printWindow.document.close();
printWindow.close();

// Close the print window after printing
printWindow.onafterprint = function () {
printWindow.close();
};
document.getElementById("billForm").reset();
}

@media print {
@page {
size: 10.5cm 15.5cm;
margin: 0; /* Remove margins */
background: red;
}
body {
margin: 0;
padding: 0;
}
.bill-display {
width: 10.5cm;
height: 15.5cm;
overflow: hidden;
}
#title, h3{
padding-bottom:0px;
padding-bottom:0px;
margin-bottom:0px;
margin-bottom:0px;
font-size:30px;
text-align:center;
}
#address{
font-size:15px;
}
#hr{
padding-bottom:0px;
padding-bottom:0px;
margin-bottom:0px;
margin-bottom:0px;
font-size:30px;
text-align:center;
}
}
Wie kann ich die zusätzlichen weißen Räume vor vor und nach wie im Bild in der Druckvorschau angezeigt werden.

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post