When I recently printed the course schedule on a web page, I searched for some information on the Internet, and finally used the following method to achieve the functions I needed. Put the table of the curriculum that needs to be printed into a div tag, then specify the area that needs to be printed, and finally call window.print to print the specified content.
Sample code (some content in the code has been omitted)