Read Offline

Read Offline example
I’m working on a plugin which allows you to download and read posts and pages offline in pdf, epub and mobi formats, and I need beta testers (please share this page with WordPress friends).

Please use the comments field below if you find bugs, typos etc.

Features

  • Settings page (Settings->Read Offline)
  • Read Offline widget (output shown in the image above)
  • Read Offline shortcode
  • You can download a pdf, epub or mobi file containing the current post or page (you have to add the Read Offline widget to see the download links)
  • The download filename is based on the posts slug ($post->post_name)
  • Adds meta data to the file
    • Title (PDF, ePub and mobi)
    • Author (PDF, ePub and mobi)
    • Subject (mobi)
    • Publisher (ePub)
    • Identifier (uPub)
    • Source URL (ePub)
    • Language (ePub)
  • Option: Add download links to the top and bottom of a post or page.
  • Permalink support (/read-offline/”postid”/”post-name”.”type”). I’ve written a how-to add permalink to plugins guide.
  • Option: Add a custom style to the ePub and PDF file
  • Option: Google Analytics read-offline event tracking. You can find these under Content » Events in your Google Analytics reports. Assumes you’re using the Asynchronous version of Google Analytics.
  • languages/read-offline.po for easy translation.

To-do / Wish List

Use

There are 3 ways you can add the Read Offline link

  1. At the top or bottom of each post and/or page (See Settings->Read Offline)
  2. Using the Read Offline widget
  3. Using the [readoffline] shortcode


The [readoffline] shortcode has the following parameters

  • format=”epub”, default: format=”pdf,epub,mobi”
  • text=”Read %title offline:”, default: text=””. %title% will be replaced with the post or page title
  • icononly=”true”, default=”false”

Examples

  • [readoffline] is the same as [readoffline text="" format="pdf,epub,mobi" icononly="false"]
  • [readoffline text="Download %title%:" format="epub"]

Credits:

The plugin is using the following libraries

  • Epub , License: GNU LGPL, Attribution required for commercial implementations, requested for everything else.
  • Zip, License: GNU LGPL, Attribution required for commercial implementations, requested for everything else.
  • phpMobi, License: Apache license (version 2.0)
  • mpdf, License: GNU General Public License version 2

The plugin is using the following icons

Changelog

0.1.9

  • Fixed a bug in permalinks that gave 404 for blogs in a subdirectory. Also removed code that gave error when downloading an ePub.

0.1.8

0.1.7

  • Minor bug fix

0.1.6

  • Added the option to add custom css to PDF

0.1.5

  • In Settings->Read Offline, added the option to add custom css to EPub
  • Added languages/read-offline.po for easy translation.

0.1.4

0.1.3

0.1.2

  • Fix typo in download.php, was including  “Epub.inc.php”,  correct is “EPub.inc.php”

0.1.1

  • Bugfix, v0.1.0 will give you “gray screen of death”, so please upgrade to this version

0.1.0

  • Added the Read Offline shortcode
  • Added, in Settings->Read Offline, option to add Read Offline to top and/or bottom of post and page

0.0.2

  • Filename based on the posts slug
  • Added meta data

0.0.1

  • Initial release

86 thoughts on “Read Offline

  1. Richard Best

    Hi there

    Great plugin!

    I think it’d be awesome if you could add an option that would enable people to:

    (1) bookmark a collection of posts they’d like to read offline; and then
    (2) enable them to export all those posts in a single file, in the order they were bookmarked.

    Do you think that’d be possible?

    Kind regards
    Richard

    Reply
    1. PerS Post author

      Great idea Richard, hardest part is to create a user interface that’s easy to use/understand. Any suggestions?

      Reply
        1. PerS Post author

          The main difference between Anthologize and Read Offline, is that Read Offline is user/visitor centric. Anthologize is for the blog owner. Agree, we could merge but again that’s a large tast.

          Reply
  2. Richard Best

    How about this:

    (1) the user can bookmark each post of interest via a link at the bottom of the post or in the post meta
    (2) bookmarked items are then all listed on a “my bookmarks” page or widget
    (3) on that page or widget, there’s an export option
    (4) the user can select a checkbox for each post the user wants to export
    (5) when the user clicks an “export” button (for the preferred file format), the export function then collects the checked posts and exports them all into a single file

    Would be awesome if the admin could select how much info is included in the export, e.g., title, body, meta, comments – all off or on

    Would also be awesome if the export feature could support a document format like Word or Google Docs.

    Thanks for considering this. Great plugin.

    Richard

    Reply
  3. Αργύρης Καστανιώτης

    Hi PerS. Thanks for developing the plugin. There is a typo in download.php on line 24. “Epub.inc.php” is installed as “EPub.inc.php”.

    Reply
  4. GPap

    A few quick notes after testing version 0.1.1:

    1. In download.php, requiring ‘library/epub/Epub.inc.php’ (line 24) fails in case-sensitive hosts because the actual file is named EPub.inc.php

    2. The produced epub does not pass validation, basically due to the Body.html being raw html without proper wrapping with something like that:

    3. Tested with non-latin content, the produced epub is not readable (I guess it is related to 2 above but had not the time to test it)

    Keep up and regards,
    Greg

    Reply
  5. PerS Post author

    Αργύρης and GPap, thank you for your feedback. I’ve fixed the problem with EPub.inc.php, please see the latest release.

    GPap, I will look into the other findings as soon as possible (early next week). Again, thank you.

    Reply
  6. John Schertow

    Hey there. Do you have any plans to add some customization features like the ability to add unique headers/footers?

    There’s a few particular things I’d like to do

    1. add custom header image to first page
    2. add article name and page number to following headers
    3. add website address to page footers

    Since my articles are all CC licensed, I’d also like add a footnote to end of each pdf to include the article source, publish date and author name.

    I’d also love to be able to style PDFs!

    I know this is all probably a lot of work, but I thought I’d mention it anyway.

    Great work on the plugin so far. It’s nice and clean!

    Reply
  7. Wkr

    Congratulations.
    If W3 Total Cache enabled this plugin gives problems. When updating any plugin always shows “Download failed.: Could not resolve host ‘downloads.wordpress.org’”. Thanks.

    Reply
  8. PerS Post author

    Hmm, strange. I’m also running W3 Total Cache, and I’m not having any problems. In W3 Total Cache I’ve enabled: Page Cache, Minyfy (except javascript), Database Cache, Object Cache and Browser Cache.

    Reply
  9. Wkr

    My config: Page Cache on, Minify (JS minifier = JSMin), Database cache off, Object Cache off y Brower Cache on.

    If I disable read-offline, then there is no problem to update plugins.

    Reply
    1. PerS Post author

      Please test this.

      Replace:

      With:

      Reply
  10. Jacques Monnard

    Your plugin does exactly what we’re currently looking for : a user-friendly editorial process to create documents online and export them in ePub and PDF format. So thanks a lot, and I hope your plugin comes out of beta soon ;-)
    I have a suggestion for ePub export : for a large post/page, a table of contents would be very useful. It could for instance be created from tags in the post (or some other tag specified by the user in the plugin settings). Would that be possible ?

    Reply
  11. Jacques Monnard

    Bug : if the blog is not at the root of the web server, and doesn’t use permalinks, then the links to download posts are not correct, because they start at the root. Removing the leading slash before index.php in function ps_read_offline_url works on our installation, (I don’t know if that solution would work in all configurations).

    Reply
  12. Jacques Monnard

    Me again : the fix above only works in function ps_read_offline_url from class ps_read_offline, but not in same function from class ps_read_offline_widget (different check for url rewriting).

    And a new bug in ePub export in version 0.1.8.1, also related to blog location : image wp-content/themes/twentyten/images/headers/path.jpg is not found if blog is not at root of web server.

    Reply
  13. PerS Post author

    Good morning Jacques. Thank you for your feedback. I’ll fix the url related bugs after work today.

    I like your idea on splitting large posts + toc (most likely splitting on h2-h5 (selectable in the settings page), I’ll add it to the “wish” list. At the moment I’m working on a new settings page for the plugin, need it for other features.

    Reply
  14. Wkr

    In version 0.1.9 I still can not update plugins, W3 Total Cache gives problems with cache and dns to Akismet. If I disable read-offline, then there is no problem.
    Maybe the problem is in the htaccess rewrite rules?

    Reply
  15. vinaysagar

    Hello Pers!
    Was looking for something like this. A feature request for Buddypress extension. I use an LMS plugin(Scholarpress Courseware). Wish there was a way to save lectures and export them into mobiles to read offline.

    Reply
  16. Monika

    I want different background of ech pdf .that is when pdf of a post is created then its background should be a thumbnail image of that post.
    How can i do this ????

    Reply
  17. Paul

    Your site is down so I’m posting here. Your plugin causes rewrite rules flush every time you navigate through admin, I think that the problem is here:

    Reply
    1. PerS Post author

      Thank you Paul, I’ll add it to the next release.

      eh, what do you mean by my site is down? This is my site.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">