StoryHack

Bryce A Beattie's website blog thing
How to Self Publish a Book

How to Self Publish a Book

Bryce Beattie

August 17, 2016

Table of Contents

  1. Introduction
  2. Software
  3. The Joy of Markdown
  4. Getting Your Work Into Markdown
  5. Design a Cover
  6. Final Text Preparations
  7. Build a .epub
  8. Build a .mobi
  9. Build a .pdf for paperback
  10. Wraparound Paperback Covers
  11. Build a .doc file
  12. Build a .rtf file
  13. Automate!
  14. Upload / Publish!
  15. Thanks for Reading!

Introduction

My Purpose

My goal in writing this book is to give fellow authors an easy and cheap way to self publish their books in the major ebook stores as well as in paperback.

These days there are tons of ways to do this. To keep the process easy, I’m not even going to attempt to teach them all to you. I’m not going to confuse you with option after option. I’m not going to bore you with histories and long-winded explanations. I’m going to teach you exactly one simple method. It’s my way, and I think it works pretty well. Maybe I should have called this “How I Self-Publish a Book.” Oh, well, too late now. I already have the domain name.

To keep it cheap, I’ll only use freely available (usually open source) software. The self-publishing sites I’ll show you also are free to use. Your only investment will be your time.

Comments / Typo Reports

If you have any comments, questions, suggestions, or corrections please go to the announcement post.

Big Warning

I’m not finished with this book yet. In fact, I may never get all the way done. So don’t be worried if you see chapters on advanced topics that look suspiciously like an outline. However, there will be enough info here to get you published.

What this Tutorial Isn’t

It’s no secret. I’m not the world’s greatest author. I’m not going to even try to teach you how to write. Not fiction nor non-fiction. There’s plenty of good information around the internet about that, anyway.

Also, this tutorial is not going to teach you how to make a killing on the kindle or sell a million copies. I have tried and failed at virtually every marketing strategy out there. Maybe someday I’ll have a foolproof plan for getting your work in front of more eyeballs. If that day comes, maybe I’ll write about it. The more I read and think about it, though, the more I am convinced that the best marketing strategy is simply writing more and better books.

There.

Now you know what you’re getting in to.

Let’s move on and take a look at the software you’ll be using to self publish your book.

Software

Before we get into formatting and preparing your book, let’s go ahead and install all the software that you’re going to need. My step by step instructions are going to mostly be for Windows users, but most of the tools have Mac and Linux versions as well.

Pandoc

Pandoc will be used to help you get your work into a usable format for publishing. It is extremely versatile.

The main website for pandoc is http://johnmacfarlane.net/pandoc

To be able to use pandoc, you’ll need to:

  1. Download the corect installer for your platform from the installers page. http://code.google.com/p/pandoc/downloads/list
  2. Run the downloaded installer.

KindleGen or Kindle Previewer

KindleGen is used to generate .mobi files that you upload to amazon to sell for the kindle. Kindle Previewer lets you test the formatting of your .mobi file. It can also do file conversions.

  1. Download KindleGen
  2. Extract Kindlegen someplace useful
  3. Add Kindlegen to your path (on windows) Here’s a tutorial on adding something to your Path

or

  1. Download Kindle Previewer (a little down the page)
  2. Run the installer.

GIMP

Gimp is an image editing software, similar in functionality to photoshop. We’ll be using it to make your cover.

  1. Download - http://www.gimp.org/downloads/
  2. Run the installer that you just downloaded.

Fotosketcher

Fotosketcher is another piece of image processing software. It takes photos and makes them looking like paintings or drawings. Sorry, this one is Windows only, but there are lots of filters for the Gimp and similar programs out there. This one isn’t neccessary. http://www.fotosketcher.com

To install Fotosketcher:

  1. Download - http://www.fotosketcher.com/download-fotosketcher/
  2. Run the installer that you just downloaded.

LibreOffice

A word processor similar to Microsoft Word. We will be using its coversion and layout features in the final steps of publishing. We’ll be using version 4, but whatever version you have will probably work.

  1. Download - http://www.libreoffice.org/download
  2. Run the installer

The Joy of Markdown

One of the skills that you’re going to learn as you go through this book is Markdown.

What is Markdown?

Markdown is a way to format text files, so that they are human readable and understandable. Markdown is also a bit of computer code that takes markdown-formatted text and converts it to something else that the computer can use. So you write something in Markdown text and the computer can spit out an html file.

Markdown and similar technologies are popping up all over the web. Many websites (especially nerdy ones like GitHub and Stack Overflow) now let you enter your comments using Markdown or a slightly modified Markdown.

There isn’t much to it. You just add in a couple of things as you type your words. To publish your book, your first step is going to be to get all of the text into Markdown.

Once you’re done, the text from your book is going to look something like this:

# Chapter 1
    
It is a **truth** universally acknowledged, that a single man in possession of a good fortune, must be in want of a wife.
    
However little known the feelings or views of such a man may be on his first entering a neighbourhood, this truth is so well fixed in the minds of the surrounding families, that he is considered the *rightful property* of some one or other of their daughters.
    
"My dear Mr. Bennet," said his lady to him one day, "have you heard that Netherfield Park is let at last?"

You see some strange symbols? That’s the Markdown of it. Those markings tell you that the line starting with # is a chapter header, and the parts surrounded by asterisks should have some kind of emphasis. We’ll get to specifics here in a minute, but I just wanted you to see how easy to read Markdown text is.

Why is Markdown Good?

  • Markdown is readable. Even though we still want to represent italics, bold, headers and a few other things, you’ll easily be able to read the file.
  • Markdown is simple. You can learn all of Markdown that you need to know in just a couple of minutes.
  • You can write and edit anywhere. Because Markdown files are plain text, you can edit them on virtually every platform. Any software that will open plain text files can do it. So it doesn’t matter what you have with you, be it PC, Mac, Tablet, or Smartphone. You’ll be able to write.
  • No overhead. Again, these are just plain text files, so they stay small, and are always understandable.
  • Markdown exports well to many other formats. THere are loads of tools out there that easily export markdown files to other formats. That’s the basis of my method of self-publishing.
  • Keep a central “cannoniacal” copy. If you want to publish to multiple platforms, that means you’ll end up with multiple files. It’s a pain to go in and change a typo in six or seven different files. You never know for certain which files have been updated. Using the free tools I’ll show you later in the book, you’ll always have a single copy that (as I mentioned before) that you edit and work on. That copy alone is used to generate all the other files that you’ll need to upload to Amazon, Barnes & Noble, and others.

Everything you Need to Know about Markdown

For most authors, there isn’t that much different formatting that you are going to need to make a professional-looking product. As I describe the Markdown way to format different things, I’m going to tell you exactly one way to do it, even if there are two ways. Also, I’m not going to cover everything in Markdown, only the stuff I consider most important to writers.

So with out further ado, here’s your most common formatting tasks.

  • headers - Headers are on their own line, and the line starts with a # and a space. For second level headers, put two - ##. For a third level header, put three - ###.
  • paragraphs - Put a blank line in between blocks of text that you wish to be presented as paragraphs. If you want to force a line break, but not a paragraph break, end the line with two or more spaces and just start the continuing text on the next line.
  • bold - Surround the text you want in bold with two asterisks on each side.
  • italics - Surround the text you want in italics with one asterisk on each side.
  • block quotes - Use like a paragraph, but start each section with a greater than symbol >.
  • lists - Separate the list itself from surrounding text with an empty line. For an unordered list start each list item with a minus sign -. You may call it a hyphen if you must. For ordered lists, start each line with a number, then a period, then a space. The example below should make this a little clearer.
  • images - If your image was named img.jpg and was in the same directory as your Markdown file, you’d just put:
    ![](img.jpg)

I made a silly example that includes all of the above formatting marks.

Here is a raw text file

If you were to put the example text through pandoc (the markdown processor we’ll be using later), with the simlest settings, you get the following:

Here is the generated html file

Software for Writing in Markdown

Because markdown files are really just plain text, any old text editor will do. However, a few out there have built-in features that make writing Markdown text easier.

Windows

  • WriteMonkey - This is my favorite of the full-screen “distractionless” text editors. It automatically senses Markdown headers in your text, formatting them a little different as you type, and can automatically generate an outline view. (Hit Alt + right arrow to open jumps window, then click “headings”) It has many other features useful for writers, like a spell checker, word counts and other stuff.
  • MarkPad - Has nice preview that shows how the Markdown you add in is going to look. Well, you see how it’d look with standard formatting anyway.

OSX

  • iA Writer - very simple, styles markdown as you type. Not fantastic for editing, but it’s my favorite for writing on the mac.
  • WriteRoom - One of the first of the recent wave of distraction free full screen text editors.

Linux

Cross Platform

Next Time

Next chapter we’ll cover what to do if you’ve already written your book in Word, LibreOffice, or something else.

How to get Your Work Into Markdown

Yes, you could write your book in a plain text editor using Markdown. And maybe for your next book you will. However, you are probably reading this book because you have already written your masterpiece and now you wish to publish it. If so, this chapter is for you.

Step 1: Export to HTML

Let’s assume that you have written your novel in a word processor. The first thing is to get it from its native format into html. Fortunately, all modern word processors have a way to export.

Save As or Export

In LibreOffice and OpenOffice click on the file menu and select “Save As.”

Then in the “Save As type” box, select “HTML Document.”

If you use a different word processor, you should be be able to find a similar function.

Step 2: Convert to Markdown.

Once you have your book in html, it’s time to get it into Markdown. For this we’ll be using Pandoc. Pandoc is available (for free) for Windows, Mac and Linux. You should have downloaded it when you read the chapter on software.

Pandoc is a command line tool, so you’ll need to open up an old school command window. In Windows, to go to your “my documents” file and navigate until you find the folder that is holding your newly-exported html file.

Hold down shift and right click on the folder.

Then select “Open command window here.” Something similar to the image below should pop up.

At the prompt in the command window, type the following instruction, replacing the obvious parts with your own filenames.

pandoc exportedfile.html -o your_markdown_file.txt -f html -t markdown –atx-headers

Here’s a breakdown of that command:

  • pandoc That’s the command to run pandoc. Mind blowing, I know.
  • exportedfile.html This is the file that you exported from your word processor. You’re just telling pandoc which file to chew up.
  • -o your_markdown_file.txt The “o” stands for “output file.” Here you are telling pandoc what name to give the markdown file it will be producing.
  • -f html “F” here means “from.” It just signals to pandoc that your source file is in html format.
  • -t markdown “T” here means “to.” You are telling pandoc that you’d like pandoc to produce a markdown file.
  • –atx-headers There are two ways to do headers in markdown. You are just telling pandoc to use the way that is going to work for the other software we’ll be using.

You will know when Pandoc is finished because a new prompt will appear in your command window.

Clean it up

Once your file has been exported, open it up in your favorite text editor. Just scroll through things and make sure that it looks right with the correct chapter headings and such. You may have to trim out a bunch of html tags. (Stuff surrounded by <s and >s)

Design a cover (the simple way)

Your book’s cover is probably going to be the most important piece of marketing it will ever have. And of course the quality of art is quite subjective. Lots of popular covers out there break the rules I’m about to set forth.

For our purposes, we’re going to make a very simple cover consisting of a single photo or illustration with the book title and your name overlaid on the top. Even with this simple formula, you can create something that professionally represents your work.

Because it is so important, you should consider hiring a pro for this. But, if you’re dedicated to do it all yourself…

Art

The first hurdle to jump over is to find the art you want to use as your cover image. The art can be a photo or a drawing.

When choosing a cover image, you’ll want to be sure to match your book’s genre. This doesn’t mean be generic, it means to be genre -ic.

For example, if your book is about zombies but the cover looks like this…

…then people will pass on by without a second look. Trust me, this was the original cover for my first novel, and they did. Yes, it is about zombies, but most people who saw the cover probably thought it was a depressing drug addiction memoir.

Finding a Cover Image

Places to go for free photos:

  • FreeImages.com - You’ll need to sign up for an account, and make sure to read any extra licensing terms for photos you select.
  • Morguefile.com - another great free resources.
  • OpenClipArt.org - mostly vector art.
  • Flickr - make sure you filter for photos with a creative commons license that can be used for commercial purposes.

And of course there are any number of pay sites like istockphoto.com and Shutterstock.com. If you want custom artwork, I’d suggest going to fiverr and post a request, make sure in your request that you mention you need a commercial license for the artwork. Expect to pay at least $50 (and going up from there) to get halfway decent custom artwork done. If you want to spend even more, but practically guarantee a great result, you can spend $300-$1200 do run a book cover contest at 99designs. Or Go to The Book Designer, find their most recent “eBook Cover Awards” post here’s an example, and look through the covers and notes, finding good cover designers you can hire.

Modifying art

If you want a different look for your cover image, you can achive a sketched or painted appearance with very little effort. The GIMP has lots of filters with dozens of options, but my favorite software for doing this kind of thing is called FotoSketcher. It’s free at fotosketcher.com and super easy to use. Once it’s installed just start it up and open the photo you want to use for your cover.

Then play with the options window that comes up.

My favorite settings are Oil Pastel Sketch, Pencil Sketch 4, Painting 5 (Watercolor), Painting 6 (Oil Painting)

Things to Watch Out For

You want your cover to have a single, interesting focus. Chose one element of your book. It can be the hero, a famous landmark, a gun, or whatever you want.

Also, there should be at least one large area of the image that is the same color, or at least has very similar colors. This is the area where you’ll be putting the book title, and that text needs to be readable.

Starting your Cover

Open up the gimp and click File >> New to make a new image. In the popup window, changes the little tap from px to inches, then enter in 6 and 9 in the width and height. Or 5.5 x 8.5 if that’s the size of paperback you’ll end up wanting. In fact, let’s go with 5.5 x 8.5, because that’s the size we will make when we format the paperback pdf. Click the arrow where it says “advanced options” and enter in 300 x resolution box. The y resolution box should update automatically.

Click File >> Open as Layer and then select your chosen cover image.

Depending on where you got your main image, once you select your image you may get a little popup that says something about “convert to RGB working space.” That’s fine, just click convert.

Here’s one that’s been imported. Photo courtesy african_fi

Put on the Text

Now it’s time to get comfortable with the text tool. You’ll find it in the toolbox dock. It looks like the letter ‘A’.

Once you select the text tool, you can change the font style, color, or size. Then you can click on the image close to where you want it, then start typing. Don’t worry if it does not end up exactly where you want it. You can always move it around after.

Changing up Text

If you want to change anything about a block of text, double click on the “T” in its layer in the layers dialog.

You can then play with the font size, color and spacing over in the toolbox dialog.

In the next picture, I’ve spaced out the letters in my name. It’s also hard to read the letters. Don’t worry, we’ll fix that in a minute.

Moving Text Around

Click the move tool in the toolbox.

Then click on the text. Make sure you click where the text has color, then drag the text where you want it. Be careful not to click in the empty space in-between. If you click and drag that, you’ll drag the background. Anyway, make sure the text’s layer is selected and the move icon appears before clicking and dragging.

Shadow / Backlight

Now we’re going to put a backlight behind the text. The same technique works to make a shadow. Now, gimp has an automatic drop shadow filter, but I want a sightly different effect.

Merge all the text layers. One by one, use the “merge down” option on the right click menu in the layyers window until all the text is one level.

Once the text is all in one layer, right click on that layer in the layers dialog and select “Alpha to Selection.”

Now click the “create a new layer” button, then click OK in the dialog that pops up. Now move that new layer down so that it is under the layer with the text. In the picture below I would need to click the little green arrow.

With the new layer still selected, right click in the main image window and choose Select->Grow. In the dialog that pops up, change the text input to .050 and click OK.

Select the bucket fill tool in the toolbox.

Click the foreground color picker.

Select white in the color picker, then click OK.

Now click in the selection area to fill it with white.

Hit Ctrl+Shift+A to clear the selection. Right click on your cover and select Filters->Blur->Gaussian Blur. Make the blur radius 75 and click OK.

Experiment with these settings to find the backlight or shadow your text needs to be readable. Here’s what the title looks like on my example cover.

Thoughts on Fonts

Because your ebook is going to be seen primarily in thumbnail form until someone buys, it’s important to choose fonts that are going to be readable at small size. Especially the title of your book.

If you want to search for fonts that you can use for free in commercial products like your self published book, check out fontsquirrel.com.

You should zoom out in the main image window to make sure the thumnail is going to work well.

Save the GIMP file

Make sure you click File > Save and choose a location and name. You don’t want to lose all your hard work.

Export to a jpeg picture

Now you’ll need to get your cover in a format that you can upload to the self publishing companies. Click File > Export to.

Choose a file name, make it end in .jpg then click Export. In the quality dialog that pops up, move slider to 94 or so.

Finalize the process by clicking Export. The big version of your cover is now done.

Make a smaller version

You’ll also need a smaller version to embed in your ebook files. Click Image > Scale Image.

In the dialog that pops up, change the height to 900 and the width to 600, then click Scale.

Then use the File > Export To, this time selecting a new name. Something like cover_smaller.jpg. Remember where you saved these two cover files. You’ll need them later.

Here’s our final cover.

There are lots of good tutorials out there for doing professional-looking text effects. Here’s a site that compiles a bunch of them so that I don’t have to.

Cover Checklist

Here’s some things to double check before you call your cover “done.”

  • Is your cover appropriate for your genre?
  • Is your image interesting enough to catch the eye of a potential customer?
  • Is your cover unique?
  • Is it simple enough?
  • Is all text readable?
  • Is all text readable at thumbnail size?
  • Does the cover match the content?

Final Text Preparations

Now it’s almost time to generate the files you’ll be uploading to the various self publishing sites. There’s just a couple of things you need to do to your book’s text file first.

Edit Your Book to Include Meta Info

A couple of steps ago you built a markdown-flavored text file of your book. Open that file back up again in your favorite text editor (Which is hopefully not notepad, but even that’ll work.)

At the very top of the file, add a line that starts with a percentage sign and space followed by the book’s title. Then hit enter, put a percentage sign, space, and then your name. There should be no blank lines in-between lines of meta data. Separate this meta data block from your first chapter by one blank line. When you’re done, it should look like this:

% The Life and Adventures of Robinson Crusoe  
% Daniel Defoe

If you want to include a copyright date, follow that same pattern on the next line, so that now the top of your file looks something like this. The &copy; part will insert the copyright symbol in your published files.

% The Life and Adventures of Robinson Crusoe  
% Daniel Defoe
% &copy; 1719 

Move Images to Images Directory

Now, go through any images you have in your book and put them in a sub directory called “images” and make sure you update the references to them in your text accordingly. This is not strictly necessary, but it really helps for organization.

If that’s not clear let’s say your book is called “Masterplan.” Here’s the directory structure you need for your project.

...\Masterplan\Masterplan.txt  
...\Masterplan\images\  
...\Masterplan\images\image_001.jpg  
...\Masterplan\images\image_002.jpg  

Include your Cover File

Now move the cover file you made into your images directory and rename it “cover.jpg”. Make sure you use all lower case. Again, this is not strictly necessary, but will make your life easier later on.

Clean up Troublesome Characters

Now you need to do a “find and replace” to get rid of smartquotes and other characters that can mess up some text-processing software. If you try to run pandoc on your file and it bonks, it is almost certain that you have strange characters that are messing it up.

Here’s a list of common things that need to be replaced.

  • Smartquotes “ or ” These should be replaced with simple straight quotation marks.
  • Slanted single quotes - ’ Should be replaced with a regular straight apostrophe.
  • Em dash — Should be two standard hyphens (minus sign).
  • Ellipsis … should be replaced with three periods.

To make your life a little easier, I’ve built a little online app that cleans most of these up for you. You can find it at: http://storyhack.com/how-to-self-publish-a-book/cleaner

And what if you happen to want smart quotes in your published files? Do not worry. Pandoc will automatically add them back in to the published files when the time comes.

Example

Here is a project that you can unzip and use to test things out, or at least see what a project should look like.

http://storyhack.com/how-to-self-publish-a-book/files/hadleyburg.zip

Now it’s time to start making the files you’ll actually upload to the various self-publishing sites.

Build an epub

Now it’s time to generate the .epub file. The .epub file will be used if you decide to publish directly through Barnes and Noble, as well as a few of the other ebook publishers. Before you try this, make sure that you have pandoc http://johnmacfarlane.net/pandoc/ installed.

Open a command window by using the file explorer to find your book’s directory, hold the shift button and right click on it to get the expanded menu, then click on “Open command window here.”

You’ll get an old school command window that’s already in the directory you need.

Here’s a template for the pandoc command you need to type in.

pandoc -f markdown -t epub --epub-cover-image=images\cover.jpg -o final.epub --smart --toc --epub-stylesheet=epub.css inputfile.txt

Then hit enter.

Bam! Your epub is created.

Here’s what the different parts of this command do:

pandoc: the pandoc executable.

-f markdown: tells pandoc that your input file is in markdown formatted text. Pandoc would probably figure this out on its own, but better safe than sorry.

-t epub: tells pandoc to create an epub file.

–epub-cover-image=images\cover.jpg: use the indicated image as the cover.

-o final.epub: name the output file.

-–smart: convert all the striaght quotation marks to smartquotes. Also fixes apostrophes and some other stuff.

–toc: generate a table of contents. It uses all of your markdown headers (see markdown notes below)

–epub-stylesheet=epub.css: This tells pandoc to use a custom css file to style the text in a way that looks professional. I'll link to the one I use this in a moment. In this case epub.css would be the name of the css file.

inputfile.txt: replace this with the name of the your book text file.

Custom .css file

I currently use the epub css starter kit file. It can be found at https://github.com/mattharrison/epub-css-starter-kit.

I’ve copied and renamed just the css file from the kit here: ./files/epub.css Note that if you just want to put ‘epub.css’ in the command above, you’ll need to copy the css file into the same directory as your book.

The css file is released under an MIT licence, so you’re good to use it in books you plan on selling.

What else?

That’s it. Like I said, your epub is done. I told you this was easy.

Preparing for the Future

If you are planning on publishing more books in the future, you may want to put the epub.css file in a easy to remember directory, for example C:\SelfPub\. The section of the pandoc command for the css would then be

-epub-stylesheet=c:\SelfPub\epub.css

Build a .mobi

Once you have an epub file, building a mobi file is easy. You will use the .mobi file when you publish your book for the kindle store. To do this, we’ll use a program called Kindlegen. It’s written and distributed for free by Amazon.

You can download it from: http://www.amazon.com/gp/feature.html?docId=1000765211

Amazon provides Kindlegen as a zip file. Once your download completes, right click on the zip file and select “Extract All.” Then click the “extract” button in the popup window that appears. Windows will put all the files in to a directory called “kindlegen_win32_v2_9” or something similar.

Copy and paste the kindlegen.exe file from the place you just unzipped it to the directory where you have your epub file.

Like I described last chapter, ctrl + right click on your book’s directory and select “Open console window here”.

In the command window, type:

kindlegen yourBook.epub

replacing “yourBook.epub” with your book’s actual file name.

Some text will whirr by for a bit and your mobi file will be created.

What to do if you get an error E23028

Sometimes kindlegen will fail. On the second to last line or so it will say Error: E23028 or something similar. There’s not much info online about it and I can’t really tell exactly what is causing it. However, it seems to only trigger when your .epub file is in too deep of a directory. For example C:\Users\Biff\Dropbox\Fiction\Short\The_Cradle\publish\cradle.epub. See how the file is 7 directories deep? I don’t know what the limit is that causes the error, but if you get this error, there is a workaround. Just move your epub to a directory that is less deep, for example C:\SelfPub and then run the kindlegen ccommand.

Now, moving that file is a pain in the butt, so let’s make it a bit easier…

For the Future

That was pretty easy. However, copying around the kindlegen file every time you want to make a book sounds like unnecessary work. Let’s make it so you don’t have to do that.

  1. If you haven’t already, make a directory on your harddrive called “c:\SelfPub”
  2. Copy the kindlegen.exe file into the c:\SelfPub directory

Now when your are in in your book’s directory, you can type:

c:\\SelfPub\\kindlegen.exe yourBook.epub

But we can make things even one step easier.

Putting kindlegen on the “Path”

The “Path” in windows is a list of places windows looks for a file or program when you type it in to a command line.

By putting kindlegen’s directory on the path, you’ll be able to just type “kindlegen yourBook.epub” without copying around your kindlegen.exe file. I would suggest moving the kindlegen program to C:\SelfPub\ just like the custom css file, then adding the C:\SelfPub directory to the path.

Again, here’s that tutorial on adding a directory to your Path

Build a .pdf for Paperbacks

There’s a lot that can be said about a book’s interior design, about fonts and gutters and ems and all that. If you are interested in all that, go get a copy of The Elements of Typographic Style. I’m going to assume that you don’t care about all the specifics, and what you really want is to produce a good looking layout for your book.

So in this chapter, we’re going to produce a pdf suitable for printing a 5.5” x 8.5” softcover book through CreateSpace (or others that accept that size).

This is a two step process. First, we’ll use pandoc to create a LibreOffice .odt file. Second, we’ll use LibreOffice to make the pdf.

Step 1: Using Pandoc to Convert to odt

To do this you’ll need 2 template files. Download them and put them in your c:\SelfPub\ directory, which by now I hope you’ve made. Here are the files:

  1. paperback.template
  2. paperback.odt

Now, open up a command window in your book’s directory, using the steps I’ve described before in the beginning of the chapter called “Build an Epub.”

Here’s the command. Just replace the parts that say “your book” with your book’s actual filename.

pandoc yourBook.txt -f markdown -t odt -o yourbook.odt --reference-odt=c:\SelfPub\paperback.odt --smart --template=c:\SelfPub\paperback.template

Step 2: Convert the odt to pdf

Now start up LibreOffice, click “Open File” and select your newly created .odt file.

Once the file is open and ready, click File > Export… (Not Export as PDF…)

Select PDF - Portable Document Format as the file type, change the name of the file if you want, then click save.

In the PDF Options screen that comes up next, make sure you check the box next to PDF/A-1a. Even you choose to use the automated process later, you’ll need to make sure this option gets checked at least once. LibreOffice will remember this setting, and this is the only way to set it.

Click Export and LibreOffice will work diligently on creating your shiny new print-ready PDF file.

Does this seem like too much work to do? Don’t worry, there’s another way. I’ll cover it when we get to the chapter on automating the process.

Wraparound Paperback Covers

This chapter still needs to be written, but here’s the gist of it.

  1. Go to CreateSpace’s cover template thing and get the template for your book size.
  2. Open the .png template file in Gimp.
  3. Use Open as Layer to bring in your current cover.
  4. Add extra layers for color/text of spine and back, leaving the “upc” code space clear. (rotate tool, etc…)
  5. export as png - sometimes if you export directly to pdf in gimp, the text doesn’t work out great. So we export to a flat graphics file first.
  6. open that exported png in gimp
  7. export as pdf

Also, Createspace has a cover maker where you can import the front cover and easily add the spine/back text if you don’t want to try doing it in GIMP. In fact almost all self publishing places have a cover creator function these days.

Build a .doc File

Now we’re going to talk about creating a Microsoft Word document, specifically formatted so you can submit it to Smashwords.

This one is a two step process, very similar to producing the pdf. We’ll use pandoc to make a libreoffice .odt file, and then we’ll use LibreOffice to export a word .doc file. To do this you’ll need 2 more template files. Download them and put them in your c:\SelfPub\ directory, which by now I really hope you’ve made. Here are the files:

  1. smashwords.template
  2. smashwords.odt

Step 1: Using Pandoc to Convert to odt

Open up a command window in your book’s directory (You shold be good at this by now), using the steps I’ve described before in the beginning of the chapter called “Build an Epub.”

Here’s the command. Just replace the parts that say “your book” with your book’s actual filename.

pandoc yourBook.txt -f markdown -t odt -o yourbook.odt --reference-odt=c:\SelfPub\smashwords.odt --smart --template=c:\SelfPub\smashwords.template

Step 2: Convert the odt to doc

Now start up LibreOffice, click “Open File” and select your newly created .odt file.

Once the file is open and ready, click File > Save As. Then in the file chooser, where it says “Save as type:”, select “Word 1997/2000/XP/2003(.doc)(*.doc)“, then click the save button.

Now you have your .doc file ready to go.

Build an .rtf

This .rtf can be used at draft2digital. Pandoc can make it directly.

I do have a template to use that scrubs out the stuff pandoc will put in that you don’t need. Just put the template file in the c:\SelfPub directory like the others.

download the template

Then open up a command window (you should totally know how to do this by now) in your book’s directory and enter the following command:

pandoc -f markdown -t rtf --template=c:\SelfPub\draft2digital.template -o yourbook.rtf --smart yourbook.txt

Automate!

You’ve done it all in parts, now it’s time to bundle it up and make it super easy every time you need new publishing files . All you’ll need to do is enter a single command.

Setting up

First, you’ll need to make sure that you have all the templates and such that I have used up until now. Put them all into your c:\SelfPub directory

If you haven’t been downloading them as we go, you can grab them all as a zip file (including the batch file we’re about to discuss).

Self Publishing Bundle

Download the kindlegen program and unzip it into your C:\SelfPub directory. Unless you downloaded it and put it on the path as described early on in the book. Then you don’t need to do it again.

And make sure that your c:\SelfPub directory is on the path. Here’s that tutorial for putting stuff on the path.

Finally, make sure that you have LibreOffice installed, and that you know where it is installed. (Usually something like “C:\Program Files (x86)\LibreOffice 5\program” Note that last “\program” its important. There will be a file called soffice.exe in the correct folder.)

The Batch File

A batch file is a text file that contains a list of commands that windows executes one at a time. Basically it is all the stuff that we’ve been typing into the console. When you get everything set up, you’ll be able to open a command window in your book’s directory, then type:

selfpublish MyBook.txt

And then the batch file will do all the work for you! It will put all the exported files in a directory called “publish.” If you update anything, you just run it again and it updates all of those files.

Download the batch file. I’m going to go over all the commands in the batch file below, so you can know what it’s doing. If you don’t really care, or it get’s too nerdy for you, just skip down to “Now run the batch

What’s in selfpublish.bat?

@echo on
REM starting self publishing process.

The echo just means that the user will be shown everything that is going on and being run by this batch file. REM are basically comments. They don’t functionally do anything to your book, but they make the batch file easier to read.

REM create publish directory if it does not exist
if not exist ".\publish" mkdir .\publish

Creates a publish directory next to your book file as a place to put all of the finished, publishable files.

REM create a temporary directory which we'll remove at the end
if not exist "c:\SelfPub\temp" mkdir c:\SelfPub\temp

We have to make some intermediate files (remember the odts?) this is where we’ll put them.

REM create an epub
REM epub with cover
IF EXIST .\images\cover.jpg (
pandoc -f markdown -t epub --epub-cover-image=.\images\cover.jpg -o .\publish\%1.epub --smart --toc --epub-stylesheet=c:\SelfPub\epub.css %1
) ELSE (

REM epub with no cover.
pandoc -f markdown -t epub -o .\publish\%1.epub --smart --toc --epub-stylesheet=c:\SelfPub\epub.css %1
)

Lots going on here. First, the batch file checks to see if you have a cover file. If you do, the it makes sure to include it when it runs pandoc. The part that says %1 just means the first variable, or in other words the part where you typed “mybook.txt” The pandoc command is similar to what we discussed earlier in the book.

REM make a mobi
SET wkdir=%CD%
copy .\publish\%1.epub c:\SelfPub\temp
cd c:\SelfPub\temp
kindlegen %1.epub -o %1.mobi
move %1.mobi "%wkdir%\publish"
cd "%wkdir%"

Kindlegen sometimes barfs when you call it and you’re in a deep deep subdirectory. We solve this problem by copying your freshly made epub to your working directory and working on it there.

REM make the odt for the paperback
pandoc -f markdown -t odt --template=c:\SelfPub\paperback.template -o C:\SelfPub\temp\%1-paperback.odt --smart --reference-odt=c:\SelfPub\paperback.odt %1

This makes the intermediate .odt file for the paperback.

REM make the pdf
cd publish
If EXIST "C:\Program Files (x86)\LibreOffice 5\program\soffice.exe" (
"C:\Program Files (x86)\LibreOffice 5\program\soffice" --headless -convert-to pdf:"writer_pdf_Export" C:\SelfPub\temp\%1-paperback.odt
)
If EXIST "C:\Program Files (x86)\LibreOffice 4\program\soffice.exe" (
"C:\Program Files (x86)\LibreOffice 4\program\soffice" --headless -convert-to pdf:"writer_pdf_Export" C:\SelfPub\temp\%1-paperback.odt
)
cd..

YOU MAY NEED TO CHANGE THE ABOVE A TINY BIT This looks for Libreoffice in the place it is by default installed. The “IF” statements check for the last 2 major versions (4 & 5) of Libreoffice. If you have a super old version, or you installed it somewhere crazy, you’ll need to change that.

REM make the odt for the smashwords doc
pandoc -f markdown -t odt --template=c:\SelfPub\smashwords.template -o C:\SelfPub\temp\%1-smashwords.odt --smart --reference-odt=c:\SelfPub\smashwords.odt %1
REM make the doc
cd publish

If EXIST “C:Files (x86)5.exe” ( “C:Files (x86)5” –headless -convert-to doc C:%1-smashwords.odt ) If EXIST “C:Files (x86)4.exe” ( “C:Files (x86)4” –headless -convert-to doc C:%1-smashwords.odt ) cd..

Same thing with this one, it check for a LibreOffice inastallation first, then make the doc file.

REM make draft2digital file
pandoc -f markdown -t rtf --template=c:\SelfPub\draft2digital.template -o .\publish\%1-draft2digital.rtf --smart %1

Make the .rtf file.

REM Remove the temp files
del /Q c:\SelfPub\temp

Clean up the mess.

Now Run the Batch

Open a command window in your book’s directory, then type:

selfpublish MyBook.txt

Where “Mybook.txt” is the actual name of your book’s markdown-formatted text file. You’ll see a bunch of text whir by. When it stops, you’re done! You have nicely-fomatted files suited for submission to any of the major self-publishing sites.

Upload / Publish!

I’m not going to walk you through the whole process for every publisher. I’ll just point you in the right direction.

Sorry.

Take heart, however. All of these places are simple to use. Basically you sign up for an account, give it some info on how to pay you, and then fill out a form and upload your book and its cover. Also, I’m not including ANY vanity press-types here. You should be able to publish non-exclusively and for free to all of these.

Self Publishing Sites

  • Amazon KDP; needs: .mobi, .jpg cover; Sell ebooks on Amazon. note: Amazon does require ebook exclusivity if you sign up for certain programs. You enter your work into these programs on a book by book basis.
  • Createspace; needs: .pdf, wraparound .jpg cover; For selling paperback copies. Createspace is owned by amazon. It can also distribute to other online retailers.
  • Nook Press; needs: .epub, .pdf for paperback, .jpg cover; Barnes and Noble’s place to self publish. You can publish print and ebook versions.
  • Smashwords; needs: .doc, .jpg cover; SmashWords has its own ebook store, but it also distributes your work to other stores. In effect, it will charge an extra 5% or so of your list price (beyond the percentage most places charge), but it will manage getting your book into many other online stores, including apple’s iBooks store and barnes and noble. you upload the smashwords .doc file to publish here.
  • Draft 2 Digital; needs: .rtf, .jpg cover; Works in a similar fashion to SmashWords. Draft2Digital can distribute to many other retailers.
  • Lulu; needs: .pdf for paperback, wraparound .jpg for paperback, .epub, .jpg cover; You can upload the print pdf to make a physical book or the epub to sell as an ebook.
  • Apple iBooks; needs: .epub and cover .jpg; I’ve been told you actually need a Mac to upload here, but I haven’t checked that out yet.
  • You - That’s right, you can sell your ebooks on thumb drive, or on your website via one of the many commercial website sales packages out there. You can do it via paypal and email. You can sell them however you want.

Thanks for Reading!

Once again, if you have any comments, questions, suggestions, or corrections, please make them over at the the announcement post.

If you’d like to thank me, then buy one of my books, or leave an honest review for something I’ve written somewhere. Or invite me on your podcast or blog. Or give me a high five next time you see me.