A question asking about a way to accomplish some e-book specific task in a programming language seems to be on-topic both here, and on StackOverflow/Programmers.
Example: this one.
Are such questions on-topic here?
I would say yes. This site is intended both for users of e-book and e-reader software as well as publishers creating content for e-books and e-readers. Therefore, at least from a broad point-of-view, programming questions should be on-topic.
I also would say yes although that particular is not the greatest.