By the book
Strictly according to the rules.
“If you are going to build a new house, then do it by the book: start by applying for the right building permits.” To do something by the book means to do it as closely to an established set of rules as possible.
Here, the “book” refers to the law. Another idiom with the word “book” is seen in this sample sentence: “He robbed a gas station again, so now the judge is throwing the book at him, and he’ll be in jail for at least a year.”
If someone “throws the book” at you, it means that the full force of the rules (the law) is used to make sure that justice is served.