Edit: To make things faster, instead of going back to the menu you can save just in front of the villager before starting to trade. Quit and reload if he doesn't have the book.
Thanks to Leo Ascendent and Tanelorn82 for the solution
I used this video 'cause it's the best method I found and don't need to search for seeds, it's in the tutorial world
All credit for the video is for Indecisive Prophecy