1. Code
  2. WordPress
  3. Plugin Development

Publish an eBook From Your WordPress Site

Scroll to top
Read Time: 8 min
Final product imageFinal product imageFinal product image
What You'll Be Creating

As a WordPress blogger, you've probably wondered whether to explore publishing an ebook from your content. How difficult would it be? How much would it cost? How much would I earn? How do I get started? This guide will answer your questions.

Three common scenarios for publishing ebooks with WordPress are:

  1. Offering a free ebook as an incentive to readers to subscribe to your newsletter.
  2. Earning revenue by selling an ebook version of your content from your site.
  3. Earning royalties through sales of your ebook on and other marketplaces.

Once you publish your ebook, you can choose how you want to offer it.

In this tutorial, I'll use the Anthologize plugin for WordPress, a free open source plugin for creating ebooks in ePub, pdf and other formats. It's not perfect and has a few quirks, but it's quite good overall.

Anthologize - turn your WordPress blog into an ebookAnthologize - turn your WordPress blog into an ebookAnthologize - turn your WordPress blog into an ebook

For this tutorial, I'm going to create an ebook from my website, Publishing with WordPress, but just a subset of the site - the Publisher's Guide to WordPress tutorial (note: creating the automated Table of Contents used there is described in another Tuts+ tutorial). 

Rather than being a user's guide to WordPress, like WPEasyGuide offers, it's a guide to all the things you need to be aware of and manage in order to publish and succeed with your WordPress site; for example, it includes everything from choosing a domain name, to search engine optimization to managing backups.

So, let's get started.

Installing the Anthologize Plugin

Install and activate Anthologize just like any other WordPress plugin:

Install the Anthologize PluginInstall the Anthologize PluginInstall the Anthologize Plugin

Then, visit the Anthologize page from the WordPress Dashboard:

Anthologize Projects DashboardAnthologize Projects DashboardAnthologize Projects Dashboard

Building Your eBook

Create your Project

From the Anthologize dashboard, create a new project:

Add a new ebook projectAdd a new ebook projectAdd a new ebook project

You'll see your project listed in My Projects:

Anthologize Project ListAnthologize Project ListAnthologize Project List

Organize Your Content into Parts

Click Manage Parts to create new parts - or sections -0 for your book and then drag posts and pages into them:

Anthologize Makes It Easy to Organize Your eBookAnthologize Makes It Easy to Organize Your eBookAnthologize Makes It Easy to Organize Your eBook

Preparing Anthologize

Once you've created the parts you want and dragged in the content, there are a few other details you may want to take care of:

1. Create an About page. I created an About this eBook page to let the reader know that this is an ebook created from online content that can be seen at my website.

2. Patch an Anthologize Bug. Lastly, there is a small bug in the Anthologize PDF cover page generation that needs to be manually patched (thanks to Adrian Lee for providing an explainer). I wasn't able to edit the file from WordPress' Plugin editor. So, I had to login to my server to edit the file:

nano /var/www/wordpress/wp-content/plugins/anthologize/templates/pdf/class-pdf-anthologizer.php

I made the edits Adrian suggests, changing line 145 from:

$this->output->Write('', $this->api->getProjectCopyright(false, false) . ' -- ' . $year , '', false, 'C', true );


$this->output->Write('', 'Copyright ' . $year , '', false, 'C', true ); 

Open source is fun! Now, back to our regularly scheduled tutorial.

3. Install XSL for PHP. If you want to export in ePub format, to sell on Kindles at Amazon for example, then you'll need to install the PHP library for XSL. When I tried to publish to ePub the first time, I received this error: "ePub export requires XSL support." Fix it with this:

apt-get install php5-xsl
service apache2 reload

4. Reprogram Ads as Shortcodes. I re-programmed the HTML for all of my ads as shortcodes. This allows me to tell Anthologize to omit them from my ebook. I used the Shortcoder plugin, which I'll be writing about for Tuts+ in the near future (check my author page). In the meantime, learn more here

Note that at this time, Anthologize's shortcode disable feature does not work with Shortcoder. So, my ebooks have ads. It appears to relate to the dynamic naming that Shortcoder uses and WordPress' shortcode regex used for finding them. If you want to fix this bug, let us know in the comments and notify me @reifman

Certainly, you can edit your PDF with Acrobat Reader or ePub files with something like Sigil (OS X) after Anthologize generates them; so you could remove ads or update layouts this way. Sigil is a GUI editor for ePub documents.

Finally, we're ready to get to the fun stuff. Exporting to ebook formats.

Exporting Your Book

Creating a Book as a PDF

PDF's are great formats for selling the book yourself or giving it away to newsletter subscribers. 

To begin, click Export Project from the Anthologize dashboard menu:

Export your projectExport your projectExport your project

Click Next, then choose the format you wish, in this case PDF and click Next again:

Choose your ebook publishing formatChoose your ebook publishing formatChoose your ebook publishing format

Make the final selections for your ebook. I choose to have page breaks before parts and I disable shortcodes, this removes the online table of contents and advertisements. Then, click Export Project:

Export your project settingsExport your project settingsExport your project settings

Now, open your new ebook. This is what my PDF looks like in Mac OS X Preview two page view with thumbnails:

Publishing with WordPress as a PDFPublishing with WordPress as a PDFPublishing with WordPress as a PDF

Creating a Book as an ePub

Follow the steps above as you did for a PDF and just select ePub. I used iBooks on my Mac to preview it. You'll see something like this:

Publishing with WordPress as an ePubPublishing with WordPress as an ePubPublishing with WordPress as an ePub

Now, let's take this to the next level by publishing our creation. 

Publishing Your Book Online

Publishing at Amazon

Amazon makes it easy to list your Anthologize-generated ePub ebook. I used their Kindle Direct Publishing (KDP) site:

Publish Your Book for FreePublish Your Book for FreePublish Your Book for Free

You can manage your books from the KDP dashboard:

Kindle Direct Publishing DashboardKindle Direct Publishing DashboardKindle Direct Publishing Dashboard

Amazon's Cover Designer makes it easy to build an attractive book cover. I used a sunrise photo from my recent trip to India as the background (I knew waking up for 6am yoga would pay off one day):

Amazon Cover DesignerAmazon Cover DesignerAmazon Cover Designer

You can charge royalties of 35% or 70%. At the higher royalty rate, Amazon charges you for distribution bandwidth; and, this rate only applies in some countries.

Royalty pricingRoyalty pricingRoyalty pricing

Amazon provides several ways to preview your book. The online publisher (shown below) or downloadable Kindle simulators:

Kindle Online PreviewKindle Online PreviewKindle Online Preview

Once you publish your book, Amazon may take as much as 12-48 hours to review it before listing it. Amazon bounced my submission back to me and sent a delayed explanation. They required that I resubmit to verify that I owned the copyright to my ebook. 

Once I resubmitted, the listing went live very quickly. Here it is:

Heres Publishing With WordPress for sale at AmazonHeres Publishing With WordPress for sale at AmazonHeres Publishing With WordPress for sale at Amazon

If you'd like more details on the process, blogger Sarra Cannon offers a nice guide to publishing at KDP.

Exploring Lulu

Lulu is an ebook (and print book) publishing service which says it can make the process of distributing your book easier. They also offer an eBook Creator Guide available free with your email address (see left column).

I had planned to use Lulu as my primary publishing example, but ran into a handful of roadblocks.

On the surface, Lulu seems to make the publishing process quite easy and if you need additional assistance with production or distribution, they have different plans beginning at $99 to help you.

Lulu Paid Assistant PlansLulu Paid Assistant PlansLulu Paid Assistant Plans

However, I realized pretty quickly that their business model seems designed to sell the $99 Assistant packages, as I ran into a number of problems with my Anthologize-generated epub document; a file that Amazon imported seamlessly.

Here are the steps for publishing with Lulu:

How to publish your book with LuluHow to publish your book with LuluHow to publish your book with Lulu

If you want to try Lulu, visit eBooks and click: "I'm ready to publish." 

Let Lulu Publish Your Book to AmazonLet Lulu Publish Your Book to AmazonLet Lulu Publish Your Book to Amazon

First, create a title for your book within Lulu:

Create Your Lulu TitleCreate Your Lulu TitleCreate Your Lulu Title

I requested a free ISBN from Lulu:

Get a Free ISBN from LuluGet a Free ISBN from LuluGet a Free ISBN from Lulu

Then, I tried uploading my epub file - and Lulu rejected it for a number of problems related to Anthologize's auto-generated code.

Upload Your ePub File to LuluUpload Your ePub File to LuluUpload Your ePub File to Lulu

I managed to work around this by using Anthologize to: 1) Export to RTF, 2) Opening the file in Word, saving it to docx and 3) Uploading it to Lulu. However, Lulu then couldn't publish the file because of a lack of proper headings for the table of contents and the document was full of ASCII codes (probably from curly quotes):

More Lulu ErrorsMore Lulu ErrorsMore Lulu Errors

From what I read online, diagnosing and fixing these errors is quite complicated. Other Lulu forum members seem to encourage publishers to try Amazon. I tried downloading Sigil to fix my ePub file but had little success. Perhaps this is why Lulu is able to run a viable business charging publishers to convert their books for them.

However, switching to Amazon's Kindle Direct Publishing worked seamlessly for me right away; it worked as I had expected Lulu to. I just had to reorganize this tutorial to present Amazon first.

Selling eBooks on Your Website

Now that you have digital ebooks in PDF and ePub formats, you can sell them from your site using a variety of approaches. PayPal offers simple buy buttons. I'm also experimenting with Easy Digital Downloads.

Alternately, you can deliver them to readers that subscribe to your newsletter. You can collect email addresses with any email subscription plugin.

Other Solutions

Other than my problems with Lulu, Anthologize worked just great with Amazon's Kindle Direct Publishing. So, I'd recommend that you give it a try first.

There are other plugin solutions to generating ebook content, some of them work a bit differently. I keep a summary of other ebook plugins and resources at Publishing with WordPress.

See My Book

You can see Publishing With WordPress listed at Amazon here; it's available for purchase for $2.99. Alternately, if you send me an email, I'll add you to the Publishing With WordPress newsletter and send you a link to the PDF version for free. You can also follow the site's updates on Twitter @pubwp.

If you have any questions or corrections, please post them in the comments. If you'd like to keep up on my future Tuts+ tutorials and other series, please follow @reifman or visit my author page.

Did you find this post useful?
Want a weekly email summary?
Subscribe below and we’ll send you a weekly email summary of all new Code tutorials. Never miss out on learning about the next big thing.
Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.