`);printWindow.document.close(); // Close the document to ensure it's ready for printing
printWindow.focus(); // Focus on the new window// Trigger the print dialog
printWindow.print();// Close the print window after printing
printWindow.onafterprint = function () {
printWindow.close();
};
}