All Collections
Author Help
How can I upload a custom PDF of my book, but still use Leanpub to generate an EPUB version of my book?
How can I upload a custom PDF of my book, but still use Leanpub to generate an EPUB version of my book?

Keywords: PDF, custom, formatting, sample, secret feature

Leanpub Support avatar
Written by Leanpub Support
Updated over a week ago

If you use one of Leanpub's Cloud mode book generation workflows for your book (i.e. GitHub or Dropbox), and you want to upload a custom PDF file you have created using another workflow, please follow the instructions below.

For those who are curious about why someone would want to do this: PDFs give you a lot more control over formatting than the EPUB generally does!

Setting Up Your Custom PDF Ebook File

First, make a folder called custom at the top level of the main folder for your book (it should be a sibling to your manuscript folder).

Next, put your custom PDF file in the custom folder with the filename SLUG.pdf, where SLUG  is the name of your book in its Leanpub landing page URL. (For example, if we were doing this with the Leanpub manual https://leanpub.com/manual, we would have to name the file manual.pdf.)

Finally, publish a new version of your book. Then, when people buy your book, they will get your custom PDF file when they click to download the PDF version.

Setting Up Custom Sample Files

Currently, if you want to set up custom sample ebook files, you actually need to add files to the custom folder for both the PDF and EPUB main ebook files, and both PDF and EPUB sample ebook files.

Otherwise, you'll get an error at the sample generation steps when you try to preview or publish.

(Although the custom upload feature we're describing in this article has been around for a while, it's still a kind of a beta "secret feature" meant for advanced Leanpub authors, and it can be a bit finicky.)

So, to get custom sample files to work, you'll need to do your own version of this:

Now, let's say all you wanted to use this feature for, was to offer readers a custom PDF sample.

What you would do is you would create the PDF sample file you want, and add it to the custom folder.

Then, you would download the other three files (the main ebook PDF and EPUB files, plus the sample EPUB file) from your book's Publish page, add them to the custom folder.

And finally, you'll need to publish a new version of your book. All the files your readers can download now - the main ebook PDF and EPUB files, and the sample ebook PDF and EPUB files - will be the files from your custom folder.

If that process seems a bit clunky and error-prone, now you know why we treat this like a secret feature!

For those who are curious about why someone would want to do this: sometimes authors want to provide their own, curated PDF ebook sample file!

Use Cases for This Feature

As we mentioned in the callouts above, this feature is useful primarily for authors who want to sell curated PDFs, along with their Leanpub-generated EPUB files.

If you're a GitHub user, you could also use this as an advanced version of our Upload writing mode, where you use Git and GitHub (along with all of its collaboration advantages etc.), instead of just using our web interface to upload your ebook files.

If you encounter any issues with this feature, or you test it and find some useful functionality we don't know about ourselves, please post about it on the Authors Forum.

OK, that's it!


If you have any feedback or questions about this article, please email the Leanpub team about it at hello@leanpub.com!

If you have any questions or thoughts on writing and self-publishing with Leanpub, please join our global community of authors in our Authors Forum here!

Are you interested in self-publishing, and creating your first Leanpub book? Here are some quick tutorials for our most popular writing modes: http://help.leanpub.com/en/articles/3088382-quick-walkthroughs-for-getting-started-on-a-leanpub-book

Are you looking for great deals on Leanpub ebooks, ebook bundles, and courses? Sign up for our Weekly and Monthly newsletter sales here!

Subscribe to our YouTube channel here: https://www.youtube.com/leanpub

Please subscribe to our YouTube channel here: https://www.youtube.com/leanpub

You can also follow Leanpub in lots of other places!

Did this answer your question?