05-20-2010, 03:18 AM
I worked in vs2005 c++ (MFC,win32).
I need to work on my project to add html or txt file converted to epub formats.
I used Calibre2,but it is too large and can not support c++,so i can not modify that source code .
I do that is difficult...
How can i get some free(or not free) source code for convert html or txt file to EPUB in VS2005 (MFC ,win32) ?
05-20-2010, 07:26 AM
Write it yourself? Transforming of basic html to a basic epub is not that hard. What is it you want to do with your project that isn't covered with Calibre or Sigil.
05-20-2010, 10:13 PM
thanks your reply.
write it myself.
I just started learning EPUB.so ,I do not know what the reference data for convert html or txt file to EPUB.
In html file include:text,picture,video,audio....
You said that is not hard. How can i start this project?
05-21-2010, 04:17 AM
Read a lot about the epub format and create some epub's yourself by hand (I find the jedisaber site to be of great help there). Look at some epub's.
If the html includes video and/or audio, than epub is not the format for you. That is not covered. You can use font's and pictures though.
By the way, you can call parts of Calibre from you project to convert to epub. So, you write some part and call a program of Calibre with your input. That should ease your project.
05-21-2010, 10:42 PM
An ePub file is just a .zip file containing (x)html along with associated images, fonts, and xml files containing metadata and a table of contents. See the Step by Step guide to ePub creation (http://www.mobileread.com/forums/showthread.php?t=43230) for links to learning more about the spec.
I don't know much about C, but I'm sure there are ways to use it to create xml and zip files, and if it can do that, it can create epubs.
05-24-2010, 04:52 PM
If you want to see some epub code in C++, then you should take a look at Sigil (http://code.google.com/p/sigil/downloads/detail?name=Sigil-0.2.0-Code.zip&can=2&q=), which is GPL'd and should be fine for your use.
Sigil, of course, is a large editing project. The bits you'll want to examine are in the Exporters directory, which has code showing how to construct the NCX and OPF files you need. As frabjous said, the rest is just zipping up the component files and setting the mimetype (which must not be compresssed).
05-27-2010, 08:49 PM
Read about EPUB (http://en.wikipedia.org/wiki/EPUB) at wikipedia, which has links to the formal specification. You can find open source XML parsers in C++, as well as zip libraries.
05-28-2010, 09:15 PM
You might try the Inside epub (http://netkingcol.blogspot.com/2009/12/introduction-to-epub.html) blog. It's a series of articles about various components of an epub. It helped me quite a bit.