开发者

possible to create ebook programmatically? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or exten开发者_JAVA百科ded discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 10 years ago.

I am investigating whether it is possible to generate an ebook, say, a Kindle book, programmatically. are there any libraries, open source or proprietary? in particular, for python.


An ebook or epub is just xhtml with some meta info and stuff. Every page is a xhtml file.

Here is a tutorial on How to Make an ePub eBook by Hand.


Many but especially see calibre which can take text in various forms or HTML and convert to epub, mobi etc.


For .epub, as others have said, any tool that can generate XHTML will work - partially. You may also need the ability to generate a .gz file, IIRC, since I think the outermost container for EPUB is of that format, but Python has support for that in the standard library. I think IBM developerWorks had a tutorial on how to generate EPUB format ebooks, maybe in Python. Search on their site for it. Liza Daly, founder of ThreePress, who specializes in publishing-related development (in Python) and is the creator of O'Reilly Bookworm, a web-based EPUB reading application, may also have some tools for generating EPUB on her site.

My own xtopdf toolkit (written in Python), which requires the open-source version of the Reportlab toolkit (also in Python) can be used to generate simple PDF ebooks from a set of text files, where each file represents a chapter of the book. In the xtopdf package (.zip / .gz file), there is a script called PDFBook.py which does this.

You can get xtopdf from here:

http://sourceforge.net/projects/xtopdf/

And this page has a guide to installing xtopdf and to using that PDFBook.py script:

http://www.mail-archive.com/python-list@python.org/msg100069.html

So if you can generate those chapter files as text, programmatically (which should be possible), you can combine that ability with the PDFBook.py program, to do what you need - programmatically generate ebooks - for the case of PDF ebooks.

If you need any help using xtopdf, feel free to contact me via my web site's contact page - dancingbison dot com slash contact dot html - use my Gmail address given there. The (hosted) site goes down for short periods sometimes, so if you can't access it, just try again sometime later.

HTH, Vasudev Ram


Amazon provides kindlegen which is a command line program for generating an ebook from XML/HTML sources.

I generated books for Stack Overflow content using a set of scripts available here (the code is a mix of Python, Java, and XSLT).

Another example is rss2mobi which generates ebooks from a Google Reader feed (this one is all Python).


creating an ebook in python is almost trivial if you want to do it in epub format.
if you want a link to something simple and working, have a look at txt2epub (and provide feedback if you please).

it is called txt 2 epub, but it also handles rst files.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜