G-code by itself only describes the series of motor movements over time, though I think it would be practically feasible to have a book contain an executable script, which would generate the same g-code as the one used to print the book. It would be really interesting to see how large the resulting book is.