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

77 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
  18. 4tegs

    Strange problem. After upgrading to WordPress 3.5 and Theme Twenty Eleven 1.5. “Read Offline” doesn’t show anylonger on the default Hompage. Neither on the top, nor on the bottom of the post, nor as a widget.

    If I select a post or a page it works well.

    Reply
      1. PerS Post author

        Must have been something odd in the old theme you had. By design, it should only appear on a single post / page. That is, it is working as it should now.

        Reply
  19. Hugues

    Awesome plugin, thanks for this! It makes super clear PDF & ePub. I have a suggestion : can you make a PDF clickable table of content please ? (I don’t know if it’s even possible…)

    Reply
    1. PerS Post author

      Tanks for reminding me, I’ll add it if the library I’m using supports it. I working on the next release, hopefully available next week.

      Reply
  20. erikvlie

    Hi Per,

    I tried entering this message on your website, but upon clicking the Add Comment button, there was a database connection error showing.

    I love your plug-in. I have one question though, and it might be my permission settings that aren’t right. The icons appear when they feel like it :-). Usually, I have to load a page a couple of times before they become visible.

    I first tried different browsers, but that doesn’t help, so it’s server-based. Then I tried changing permissions (777 on the plug-in dir, 777 on the dirs inside…) on the directories, but that doesn’t do much good either.

    It’s not a big deal of course, but it would be nice of they did appear. I’m running CentOS 6.3 x86_64, PHP 5.4.8, MySQL 5.1.66-cll and Apache 2.2.23. No caches on my Wp installation.

    http://wordpress.org/extend/plugins/read-offline/

    Reply
  21. Steff

    Hi Per, Great Plugin, works perfectly for me only one thing I cannot get right.
    I use a plugin called formidable to create list questionaires. In a custom display I can filter these questionaires in a certain way. On my site they appear right, The one I filtered. But when I try to make a offline PDF, read-offline picks the first questionaire not the filtered one. Any idea’s what the problem can be?
    Furthermore I am really pleased with it because it’s the first plugin that lets me create good looking pdf’s of tables etc.
    Thanks
    Kind regards Steff

    Reply
  22. Tim Kaye

    Per, this is a really terrific plugin for creating ePubs: they pass with flying colours in Sigil. But I do have two questions.

    1. Do you plan to add the facility to generate a Table of Contents in the ePubs and mobis? Otherwise I’ll have to use RO on my XAMPP site to generate the ePubs and then add the TOC manually in Sigil before uploading to the live website for downloading. Obviously, I’d much prefer to automate the process!

    2. I cannot generate valid mobi files at all. I keep getting an “end tag” error. This surprises me because the ePubs are flawless. As things stand, I will have to take the ePub from the above process and run it through Kindle Previewer to generate the mobi for uploading.

    Thanks very much!

    Tim

    Reply
    1. Tim Kaye

      Per,

      I have been delving a little deeper into this. I have now found that Read Offline does automatically generate a Table of Contents in ePubs, so long as I use an appropriate plug-in to put the ToC in the post. I have achieved excellent results using Table of Contents Plus. This allows me to put the ToC where I want it in the post, and then Read Offline reproduces it flawlessly in the ePub. Both ToCs even hyperlink to the appropriate points in the main body of text. Even better, I can style the ToC on both the web page and the ePub using CSS. It works perfectly, so there’s absolutely nothing to fix here — thanks!

      Unfortunately, PDFs produced by Read Offline don’t seem to respond to CSS styling. The result is that (a) although PDFs also reproduce the ToC from that inserted by Table of Contents Plus, they include text that I don’t want included here, and (b) as Hugues pointed out above, the ToC in the PDF is not hyperlinked to the text.

      Finally, none of this helps produce workable mobis. At present, I get the following error when I try to generate them:

      I don’t know what this means, but I am sure you do. If I take the ePub generated by Read Offline and convert it manually in Calibre (version 0.9.16), it works perfectly, so I’m sure this can be resolved.

      Many thanks and best wishes,

      Tim

      Reply
  23. Richard

    Hi there Per

    Thanks again for this great plugin.

    I was wondering whether you’re still planning on implementing an export to Word option please? If so, I’d be happy to pitch in with some support to speed up development.

    On a separate note, is it possible to add CSS for posts that will change the font and styles and add padding/spacing below paragraphs? I’ve not been able to get that to work but perhaps I’m doing something wrong.

    Thanks again
    Richard

    Reply
    1. PerS Post author

      Export to .docx is on my to-do list. You will also be able to add styles to control the look ‘n feel (not sure yet if you can modify the docx using styles).

      I’ve been rather busy lately, but plan to work on this plugin in the weeks to come.

      Reply
      1. Peter for a Couples Odyssey

        hey there!!!

        for a while now we’ve been using this plugin, and boy is it great or what :) since our website is for travelers with limited internet access this plugin really helps us out.

        fiddling around with the settings we noticed you are planning on the docx option. and than we noticed you posted that about a year ago… Hoping you still are aiming at this, because this would help us even more.

        Cheers and keep up this good stuff!

        Peter for ACouplesOdyssey

        Reply
  24. Richard

    That’s great news. Thanks Per. Do let me know if I can do anything to help, like beta test for you or contribute in some other way.

    Cheers
    Richard

    Reply
  25. Richard

    Sorry for yet another comment. Last one for the night… . I’ve just noticed that, if you’re using a password-protected version of a WordPress install, the download links are still accessible to a person not logged in. Do you know whether it’s possible to prevent the download links from being publicly accessible to people who are not logged in and don’t have access to the relevant post?

    Thanks
    Richard

    Reply
      1. Tim Kaye

        I use s2member to password-protect my WordPress installation. I have found that adding the following code to the end of my functions.php file deals perfectly with this issue:

        Best wishes,

        Tim

        Reply
  26. Elf Zig

    This plugin is worth its line in gold. Thank you so much for it!

    My feature request: let the featured image (formerly known as post thumbnail) of a post become the cover image of the export.

    Thank you so much again!

    Reply
  27. Kathy

    Not sure if this has been added to the wish list. I would like the ability to turn it on and off for different pages/posts. I’ve had to turn it off because there are a few pages that I don’t want it on.
    Thanks

    Reply
  28. Georg

    Hi there, your plugin is a wonderful idea, but the Pdf download produces a Internal Server Error. The other links work like a charme….
    Any thoughts on what the problem might be, or any ideas where to check?

    Cheers Georg

    Reply
  29. Sue

    Congratulations on an excellent plugin!

    My only request/suggestion would be to either insert the name of the site as “author” or use the name of the poster.

    I’ll definitely be supporting this wonderful WP addition. Bravo!

    Reply
  30. Helene

    Hi Per,

    Nice plugin, thanks. Would it be possible to have it on forums also? When as widget in the sidebar, it only captures the last post, not the whole page.

    Thanks
    Helene

    Reply
  31. Vince

    Using Advance Custom Fields for a lot of information on my page, when I use this plugin it only pulls information from the Description field. How do I change it so is uses custom fields too?

    Reply
  32. Vince

    it appears that there’s no support for page-break-inside as it seems to be ignoring the division and breaking.

    Reply
  33. Richard

    Hi Per – Hope all is well. Just wondering whether you’re still planning on updating the plugin?
    Cheers
    Richard

    Reply
  34. Kim

    We have created a WordPress site that embeds interactive charts into the posts using the Visualizer plug (http://wordpress.org/plugins/visualizer/). The plugin uses Google Visualization API to render charts, however, when you save to PDF using your tool, these charts do not show up in the PDF. Is there any way to include these charts in the PDF? We publish research reports and we wanted to automate the PDF output function rather than having to create PDFs of the reports manually. Can you advise?

    Reply
  35. Wrought

    Read Offline conflicts with AcademicPress plugin:

    Error: Unable to send file testing-this.epub.epub. Output buffer contains the following text (typically warnings or errors):
    Notice: Trying to get property of non-object in wp-content/plugins/academicpress/Acp/Bib/Shortcode.php on line 22 Notice: Trying to get property of non-object in /wp-content/plugins/academicpress/Acp/Bib/Shortcode.php on line 35

    Reply
  36. Jerry Lasky

    When I use Read Offline with the Twenty Eleven theme, the print icons appear at the top of ALL pages (I selected top of page as the location in settings) but not at the top of posts. Is there a way to have 1) The print icons appear only on pages I select and 2) Also appear on posts I select. If there is code I need to modify could you provide the code and specify the (child) files that need to be edited. Thanks, Jerry

    Reply
  37. Rezo

    Hello,

    great work, thanks for your plugin.

    Question 1: how can i use the plugin as php function in my wordpress template?

    Question 2: how can i let plugin to use the print.css version and not all on the page or post? I have on some posts slider &/or forms (contact form), i would plugin dosn’t add these all to pdf document.

    Question 3: Is there a pro version?

    Thank you for answer
    Rezo

    Reply
    1. PerS Post author

      You can run plugin the in your template (it must be activated first) by doing:

      There’s not support for styling yet and there’s no pro version yet.

      Reply
  38. Helene

    Hi,

    With the new versions of Cbox theme (1.0.5 and 1.0.6), the read later dowload pdf line appears in the caption of the slides in the slider. Increasing the width of the caption banner see here: http://dev.commonsabundance.net/

    This did not occur with Cbox 1.0.4.

    Is there anything to do on your end? The devs at Cbox suggest I deactivate your plugin…

    Thanks
    H

    Reply
  39. Cédric

    Hi,

    Impressive plugin with a lot of quality. Congrats, and thank you !
    Two questions please :
    - I didn’t understand how to use meta. Could you explain a bit more please? Could it be used to have some king of template (ex: always have site URL from which the pdf has been created. As I understand, PDF are a bit anonymous right now).
    - Is there a quick way to make the plugin compliant with custom posts? My site has plenty and I can’t generate PDF for them ;-(

    Thank you very much once again for the quality of plugin,
    Cédric.

    Reply
    1. Per Søderlind Post author

      Hi Cédric,

      I’m working on the next version which will support custom post types + meta information. Not sure when it will be ready.

      Reply
  40. Michael

    Hi, I can’t get the correct chinese font when i export the pdf file. Would you mind telling me the way to make it right?

    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="">