Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been writing a Word document that I want to distribute online. However, I want the document to be accessible to everyone, including

  • People who want to print it on A4/Letter from PDF. Note that the PDF should be output in different paper sizes (for example, a PDF for a Kindle DX has very specific margins).
  • People who want to read it on the ebook reader in a native format (e.g., .mobi)

How can I write a single script or command that would take an input document (doesn't have to be Word, I can write in Docbook, if need be) and have this command output the document to all the required formats?

share|improve this question
Plain text file. ;) – iglvzx Jan 6 '12 at 17:23
Sorry, plain text won't work... I need the formatting. – Dmitri Nesteruk Jan 6 '12 at 17:42
up vote 5 down vote accepted


Create one file in a format that flows the text to fit any sized screen at any level of magnification. This is the approach taken by most ebook formats such as Kindle's.

PDF is not a suitable solution, there are just too many different sized devices.

Publishers can elect to create their own Kindle books in-house by using a free software program called KindleGen. This is a command line tool that allows you to build a Kindle book based on HTML, so content in either HTML, XHTML, or IDPF 1.0 or 2.0 (OPF + HTML) is the best source for incorporation into an eBook.

(*from Amazon Kindle Publishing Guidelines)

HTML is also a pretty good format for publishing online ;-)


I note that I can read ebooks downloaded from Project Gutenberg on my Kindle. So It is clear you can publish ebooks for Kindles without being tied to Amazon. I suspect that if you want copy protection on Kindles you may have to go through Amazon and pay a tithe. Of course this sort of (unprotected) content works on any device with a .Mobi reader.

Wikipedia says

Unencrypted Mobipocket books can be read on the Amazon Kindle natively as well as in Amazon Kindle apps on Mac OS X, the iPhone, Android devices, Windows, and Windows Phone devices. By using third-party programs such as Lexcycle Stanza, calibre or Okular, unencrypted Mobipocket books can also be read on Mac OS X, the iPhone, Android devices and Linux.


Long term plans for the Mobipocket platform are in question in the wake of Amazon's announcement of the Kindle Format 8,[11] which moves in the direction of HTML5 and CSS3.

So HTML + CSS seems a good direction, at least as a common intermediate format.

As an aside, I would start with Plain Text Markup like Pandoc's superset of Markdown and generate other formats using something like PanDoc.

share|improve this answer
I couldn't care less about copy protection and the like. My problem is that I want people to have the best option available to them. For a Kindle, that option is a mobi file, whereas for a Kindle DX, this is clearly a PDF. There's also a large question mark around graphics and the way these are embedded. Overall, I don't see how a strategy of writing, say, HTML would help me, given that HTML loses a lot of typographic flair that I would want my document to have. – Dmitri Nesteruk Jan 6 '12 at 18:57
See example of creating a customised PDF from text. I use a Makefile with a similar but simpler toolset so that typing make once produces HTML and PDFs from all the text files I have edited since the last time I ran make. I just use the default PDF size produced by my toolset so I expect you will have a much bigger job to set everything up but after that its just one command to create any number of new sets of variously sized PDFs or other output formats. – RedGrittyBrick Jan 6 '12 at 22:32
The example I mentioned in my previous comment has now been moved here – RedGrittyBrick Mar 30 '12 at 18:52
Thanks, however I really do not like pandoc. A simple conversion of TeX to HTML showed that it cannot even convert fancy quotes properly. Fidelity is everything in this game... – Dmitri Nesteruk Mar 30 '12 at 18:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .