The answer is as follows:
The first case:
Because the homonym of "book" is "tree". "Pig" is on the tree, that is, on the book, that is, the picture of the pig is printed on the book, so it is not surprising that the pig is on the tree (book).
The second case:
Because people's dreams are not consistent with reality, all kinds of dreams are not strange, so it is not strange for pigs to climb trees in dreams.
The third situation:
A tree was blown down by the strong wind, so the pig went up and ate the leaves playfully.