Invite-icon
Feed-icon-14x14
SIGN UP FOR THE NEWSLETTER
Find books, people, authors & groups
-- or --
Explore-button
1063 books
API: CONVERT TO EPUB
This tool accepts HTML documents and generates EPUB files. Post a valid HTML file or zipped HTML archive to this url to get an EPUB version as the response.


TITLE (optional)

AUTHOR (optional)


UPLOAD A FILE (REQUIRED)
 

API Details

Parameters
Input is accepted as multipart, UTF-8 encoded form data from a POST request to the URL of this page. Any other kind of request will return this form. The parameters are:

  • file (REQUIRED): The form-encoded data of an HTML document or zipped HTML archive file. Image formats supported are CSS, PNG, GIF, JPEG and SWF. In HTML documents, heading tags h1, h2 and h3 will be interpreted as entries in a table of contents, and anchor links will be inserted before each one. Scripts and objects will NOT be removed.
  • title (optional): The title for the epub, corresponding to the Dublin Core title element.
  • author (optional): The author's name. This corresponds to the Dublin Core element called creator, with an OPS specification of role="aut" in the epub file.
  • rights (optional): A rights statement. This corresponds to the Dublin Core "rights" element. It can be any string of text, a URL or a standard copyright statement. It can be as long as it needs to be, but we recommend using a hyperlink to include longer texts such as licenses.
  • desc (optional): Any descriptive text relevant to this package or file.
  • lang (optional): Language and/or locale for Dublin Core "language" element. Example: en-US for US English language.
  • fast (optional): Set to 1, this will bypass nicely formatting the resulting XML with line breaks and spacing in favor of speed. If you plan on editing the output, you may want to leave this off, as the default is to nicely format all XML.

The converter will try to guess all fields not provided. On multiple file uploads, the converter will attempt to guess unspecified fields from the first HTML file in the archive. Mappings are attempted from the document title element, "author", "copyright", and "description" meta tags, and the lang or xml:lang attribute in the HTML root element.

Embedding In Your Pages
Here's some code that allows you to embed a form in your page to access the tool from your own site. This includes one hidden field to show how you might pass parameters without user input or through a script.



Validation
In the interest of speed and convenience, this API does very little validation on input or output. A small program called tidy manages conversion to XHTML. Beyond what tidy can accomplish, we don't tamper with the resulting HTML, so results will vary if run against an epub validator like epubcheck. The best way to ensure validation is to pass XHTML 1.1 as input (though reading systems should be tolerant of epub files with relaxed XHTML). We do appreciate your feedback for improving the tool's compliance. See the EPUB specifications for more details.

Caveat
You may access this URL from anywhere on the Web, as long as you don't send excessively large files (over 10 MB) or make an excessive number of requests in a given time period (no more than one request every 5 seconds). Any IP address violating these limits will be permanently blacklisted from our server.

Disclaimer
This API is provided as a free service, with no guarantees or liability.

Coming soon
Multimedia and fallback support, specific error handling and return values. And more speed!