Many a man who has had “the book” thrown at him would infinitely prefer that it had been a literal book, no matter how large or hefty.
But no, it is a figurative book, or, rather, the contents of a literal book.
Originally, and usually, “the book” is the maximum sentence that a judge can legally impose upon one convicted of a crime, and is often interpreted to mean life imprisonment.
However, the metaphor has now been taken into non-criminal slang and is variously interpreted.
In military circles, for instance, it usually implies a severe sentence resulting from a court martial, but it also may mean nothing more serious than a stiff reprimand from a superior officer.
In family circles, father may “throw the book at” an erring son or daughter by depriving him or her of certain privileges.
The expression “to throw the book at someone” appears to be of American origin, but, as with most criminal argot, its history is dubious.