"[...] another thing I missed is a way to get the data as a
variable instead of as a file. This would let me serve the generated
"book" via Web or send it directly to a Kindle device without having
to save a temporary file on disk."
This should help =)