StoryHack.com

Introducing Pandoc ePress

update: This software has a new version and a new name. Go see the Self Publish a Book page for more info.

Ok, so a while ago I got all excited about a piece of publishing software that could make my life a little easier. The software was called Jaguar PS. Basically, it is a tool for authors who want to easily convert their works to useful formats, like pdf, epub or kindle. What a great idea – have one source file for any work of fiction I write, then run it through a program that spits out all the formats that I want. I can upload them to the various distributers, or I can sell them /give them away directly.

The author of the software put up a testing release and I played with it a bit. Long story short, it required a couple of extra steps before the files were actually ready to go. Plus, it’s been a while since the author posted anything.

So I set out to make my own.

As it ends up, there are already some tools out there that make file conversion like this easy. The problem is that most of these are either command line, or they only work with one format.

“Hmm,” I said to myself. “What if someone made a program that streamlined the use of these tools, you know, so that anyone could use them?”

This is what I came up with:

Pandoc ePress

Right now, my program takes a specially formatted text file (more on this in a minute) and produces ready-to-go .mobi (kindle) and epub files. You can also include a cover in the file, if you have one.

The actual conversion work is done by two other programs, which you’ll have to install separately, Pandoc & kindlegen (scroll down a bit if you don’t see it when you go there).

This is the first time I’ve ever tried to write something in c#, so it’s not perfect. Also, It’s windows only. Sorry.

Installation

1. Download Pandoc & run the installer. When the installation asks you if it should put Pandoc on your Path, say yes. Or check the box. I can’t remember which just now.

2. Download & install kindlegen. Kindlegen doesn’t have a real installer, so you’ll have to do a little work. Just unzip the kindlegen files somewhere, I suggest c:\Program Files\kindlegen or something similar, and then manually put that directory that holds kindlegen.exe on your Path. If you don’t know how to do this, you’ll have to wait a while until I have time to write a more full tutorial.

3. Download Pandoc ePress & run the installer.

Usage

Here’s the hard part. You have to get your work into a plain text file that is very, very similar to markdown.

Basically, your file will look like this:

% Book Title
% Author Name

# Chapter Title

Chapter text here. You must put two lines for the program
to recognize a new paragraph. If there are is just a single
line break, like there is in this paragraph, the text will be
treated as a single paragraph.

Just like this. If you want something in italics, you put underscores around it _like this_. If you want
something bold, you put two asterisks around it **like this**.

If you have a block quote, you can do that by putting a greater than symbol before your paragraph.

> This is an example of a block quote.

# Chapter The Second

blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah,
 blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah, blah,
 blah, blah, blah, blah, blah, blah,

Once you have your text file done, you just run the program, select your text and cover files, then hit “go to press” The program just drops your epub and mobi files in the same directory as your master text file.

If you don’t like the formatting of the epub (paragraph spacing and the like), feel free to edit the epub.css file in the Resources directory of your Pandoc ePress installation.

Example

Okay, so here’s  a real text file and the results I got from running the program.

Text file: The Man that Corrupted Hadleyburg, by Mark Twain

Cover file: Hadleyburg cover

And here’s what the program produced.

epub: The Man that Corrupted Hadleyburg

.mobi (kindle): The Man that Corrupted Hadleyburg

The Future

If there’s any interest, I’ll be adding features to this as time goes on. My two main targets are a print ready pdf for createspace paperback publishing, and a .doc file that meets smashwords specifications. And if there’s no interest, this’ll be the last you hear of it, and I’ll just build anything else into it for my own use.

Posted: September 13, 2011
Tags: Tags: , , , , ,
Category: author resources

Comments (13 Responses)

September 13th, 2011 DarcKnyt

Hey bud, your final links don’t seem to work. They don’t go anywhere but back to your site. I would be interested in seeing this fly, though. Let me know if you need some testing. I might be able to manage it later this month.

September 13th, 2011 Bryce Beattie

Whoops. Misspelled files. I fixed it.

September 15th, 2011 Mark

I don’t know if it’s any easier to use, but I think the Calibre ebook manager program can do this, too — import a text file formatted as you say and export one in any of the popular ebook formats. It uses a Markdown runtime or something very similar. Somewhat less cobbling and fiddling is involved, but there’s a good deal of that available for the inclined.

September 15th, 2011 Bryce Beattie

Mark, thanks for stopping by and bringing up Calibre.

Calibre is probably the best ebook library management software around. If you are primarily a reader, it’s reasonably all you’d ever need. It’s what I use to manage and convert documents for my ereader.

As an author, though, it doesn’t do everything I need. My current plan is to distribute my self-published work to four (possibly 5) places: Amazon’s KDP program, Barnes & Noble’s Pubit program, Smashwords, and Createspace for paperbacks. I have a little more control over the formatting by using Pandoc as a back end. For Smashwords I need to end up with a .doc file and for Createspace, I need a well-formatted pdf. Calibre just isn’t built to meet my specialty needs. Plus, I like the ability to put the Title & Metadata at the top of the master file and have it put in the right places in the ebooks. Calibre does handle markdown docs, but I don’t think it can do that automatic metadata stuff.

The possible 5th place is through a store on my own website.

I’m also going to change the name in the next version, as it looks like I’m going to have to use a couple more open source programs to make it do what I want it to do. The good news is that the libraries I’m looking at have more liberal licences, so I’ll just be able to bundle them with the program.

September 15th, 2011 DarcsFalcon

This sounds like a pretty cool program! I love the name too. :D I’d like to see this take off – I think it can meet the needs of the self-pubbed crowd very well.

September 23rd, 2011 Nick

I think the plain text file aspect is a deal breaker for me. If I have to format it for a text file, I could just as easily format it in word and transform it there, at least for Kindle. Epub requires a bit more work, but while this is a great idea, I’m not sure if it really makes it that much easier.

September 26th, 2011 Bryce Beattie

In my mind, this is how it makes things easier – you only have to learn one thing, the formatting of your manuscript in plain text. And formatting it for plain text usually involves a couple of “find & replace”s and a “Save As”. Nothing terribly difficult. An author won’t have to worry about learning any other technology. I’m getting close to releasing the second version, which will output to epub, mobi, doc (for smashwords), and a paperback-ready pdf that can be uploaded to Lulu or CreateSpace or Unibook and probably Lightning Source.

You won’t have to read and reread smashwords formatting guide, because your file will be produced in a way that meets the requirements. You won’t have to figure out the lesser used functions of your word processor or learn a full publishing program (like quark or indesign) so that you can have a well formatted self-published paperback.

My goal is to have the program spit out professional-quality files without any serious extra work. Of course there will be power users that want a little more control or special formatting. This software won’t be for them. It’ll be for authors who just don’t want to hassle.

October 1st, 2011 Mohan Chunkath

Great idea!Can this handle images? My proposed book will have very short chapters with one or two images in each chapter. Will Pandoc ePress be able to handle that? Thanks.
Regards,
Mohan

October 3rd, 2011 Bryce Beattie

Yes it can. basically you just
![alt text for image](/url/of/image.png)\
For more on images, see pandoc’s documentation.
And make sure you check out the second version of this software over at: http://www.howtoselfpublishabook.org/self-publish-a-book/

October 11th, 2011 Peter

Hi, great idea, but why you don’t use full potential of the pandoc? Add please output to more formats, it is ready for it. When it will support html, pdf, rtf, docbook, latex, odt, and open document. Do it please, then it will be perfect :)

October 11th, 2011 Bryce Beattie

You do end up with two odt files when you use the new version of the software. I’m trying to focus the software on producing exactly what the Do-It-Yourself self publishing author needs, and I think the current outputs (again, of the new version) cover all the big self publishing systems. I’m going to do my best to keep it as simple and option-less as possible so that anyone can use it. Anyway, it’s not hard to add another format to the list, so if you can give me a convincing reason, then I’ll put it in.

February 3rd, 2012 Dmitri

Why does the generated .mobi file have two pages with the cover instead of one? Am I missing something? (Using the Kindle app to view.)

February 3rd, 2012 Bryce Beattie

My guess is you’ve probably inserted the cover as in image into your master text file. If you include a cover image, I think pandoc automatically inserts it at the beginning of the ebook.

Leave a Reply

Font Size