General plugins (Local): Lesson PDF Export

Maintained by Picture of Adam King Adam King
This plugin allows lesson modules to be exported to PDF documents with optional protection.
223 sites
35 fans

This plugin visually displays the option to output lesson modules as PDF documents.

There are many settings that come with the PDF export plugin including custom font, footer texts, document protection, cover colours, password protection, strict exporting and more. 

Document pages are ordered the same as each lesson and question pages are also supported, although some answers are not shown (such as short answer questions).

This plugin was developed for use on the SHEilds eLearning platform. If this plugin does not match your use-case, please open a ticket on Github detailing what you require for this to become a useful addition to your Moodle plugins.


Screenshot #0
Screenshot #1
Screenshot #2
Screenshot #3


Picture of Adam King
Adam King (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Picture of Ramzi Jildeh
    Thu, 27 Apr 2017, 2:58 PM
    Hi Adam, thank you for your help, it works now with the "freeserif" when we add that to the default font for the plug-in, and the Arabic text prints well to PDF using that font, but there remains a small thing that the Arabic in the PDF header and footer still showing "???" Is that taking a font from somewhere else? Do you know when the next release will be ready, because we would like to be able to change fonts as you indicated? Thank you for your time and help.
  • Picture of Adam King
    Thu, 27 Apr 2017, 5:16 PM
    Hey, I just fixed the issue with the title using its own font; didn't see that one slip past me! I'll release today, but finding a good way to allow font uploads is proving hard. Mostly just because of the nature of the Moodle Files API. I highly recommend downloading this repository and extracting the "fonts" directory to your Moodle data directory (/path/to/moodledata/fonts). This will allow TCPDF to use the fonts it was originally designed to be shipped with such as dejavusans, which works great with Arabic. I will be looking to get these fonts either included with my plugin or uploadable via your own means. Thanks for your patience, in the meantime!
  • Picture of Ramzi Jildeh
    Tue, 9 May 2017, 3:24 PM
    Many thanks for your reply and hard work. It seems you've not yet released the new version (as of 9 May). When you do, presumably we can add other Arabic fonts as well in the same way. We have not been able to update the plug-in from the github files for tcpdf. There does not seem to be a fonts folder inside our moodledata folder. Are we doing anything wrong? Do you know if the TCPDF project will make your plug-in obsolete? And could you please advise when ExportPDF might have support for Moodle 3.2.X or 3.3? Thank you so much.
  • Picture of Ramzi Jildeh
    Tue, 9 May 2017, 3:42 PM
    A different issue with the plug-in (using the 11 April version): when we use the lesson as a student, and fill in answers and multiple choice questions etc. the answers are submitted, but then do not print when we try to Export the Lesson to PDF. Is there a way that student answers can be printed alongside the lesson text and questions?
  • Picture of Adam King
    Fri, 12 May 2017, 5:00 PM
    Hey, apologies for the delay! I've had other projects on the go and it's been a little consuming. I'd love to work on a means to upload fonts from the user interface however fonts need to be converted before being added to the /tcpdf/fonts/ directory. You can convert them online yourself if you want to, but I can also do it with code. The only issue is I need to look into creating a separate page for this, the standard moodle settings from adminlib don't seem to handle uploading to the moodledata directory very well without abstracting the files (hashing, etc), definitely want to move forward with this though.

    TCPDF is a programming library and, as such, shall never replace any project that uses it; it's not something you can use on it's own as somebody needs to write code that incorperates it.

    Regarding your issue, do you want the PDF to include the answers the student submitted? This could prove problematic, given how TCPDF writes HTML but it's not impossible, I imagine it might cause some issues if I start writing code that touches more Moodle internals though as it will date the plugin (make it very easy for it to become incompatible with older or newer versions).

    As it stands, the plugin uses some outdated functionality that will not be there in future versions (YUI, for example), but I want to support as many versions as possible before I have to re-write to use AMD modules and JQuery, among other standards. I'll have to see what needs to change for it to work with 3.2 and 3.3 (if it doesn't already), but I am definitely going to support it as Moodle is moving forward fast and great. It may already work, it may not, I haven't set up a development platform for it yet sadly.
  • Picture of Adam King
    Mon, 15 May 2017, 8:13 PM
    Sorry, I should clarify; your Fonts directory is likely under /lib/tcpdf/fonts
  • Picture of Adam King
    Tue, 11 Jul 2017, 9:46 PM
    Custom fonts are now able to be uploaded for use in the plugin (with TCPDF). TCPDF can only convert .ttf and .otf files at the moment, I believe. There is a new version of TCPDF, called tc-lib-pdf, which has the ability to convert fonts on-the-fly, but that's on Moodle to adopt it or not. The new project for TCPDF can be located here if you want to look into it at all.
  • Picture of Adam King
    Wed, 12 Jul 2017, 11:08 PM
    I've updated the plugin to use AMD modules for 3.0+ support, all changes made can be seen here
  • Picture of Arno Wilhelm-Weidner
    Thu, 12 Oct 2017, 5:42 PM
    Hi, is there a possibility to use the plugin with the MathJax-Filter so formulas are displayed correctly?
  • Picture of Kathryn Becker
    Tue, 28 Nov 2017, 8:26 PM
    This works for us (THANK YOU!) except the client wants the PDFs to export unsecured. I'm using the most recent version as of September 2017. Am I missing a step in setup?
  • Picture of Adam King
    Wed, 29 Nov 2017, 1:26 AM
    Hey kathryn, glad to hear it's still useful! If you don't want any security on your PDF documents then do not set a password for the documents on the settings page and apply your permissions appropriately; the checkboxes are tick-to-give permissions. Given that some people require security off the bat I thought it unwise to leave them unsecured by default.
  • Picture of Michael Milette
    Sat, 17 Feb 2018, 4:29 PM
    Any chance of a version for Moodle 3.4 in the near future? If so, when? smile
  • Ricardo Caiado
    Sun, 18 Mar 2018, 4:38 AM
    Any updates do Moodle 3.4?

  • Picture of Ivan Gorbachev
    Fri, 6 Jul 2018, 5:04 PM
    Hi everybody! Thank you for you plugin!
    Can you help me =)
    I can't find magic button 'Export as PDF' =)
    Where it should be ? Can you show a prints creeen =))
  • Picture of Roman Barba
    Thu, 30 Aug 2018, 2:05 AM
    Hello Adam.
    Thank you for the useful plugin.
    Do you have any information regarding the launch of the 3.5 version?
    Thank you for your update.
1 2 3
Please login to post comments