## General plugins (Local): Lesson PDF Export

local_lessonexport
This plugin allows lesson modules to be exported to PDF documents with optional protection.
92 sites
22 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.

### Contributors

• Thu, 16 Mar 2017, 7:54 AM
Hey,
moodle version 3.1.3+ (Build: 20161202)
theme "essential" 3.1.1.4 (Build: 2016061713)
install with "Install plugins from the moodle plugins directory"
yesterday, i could not open my lesson on edition mode ! but today it's good !!!! I dont no why, i uninstalled and reinstalled it
but i want to know What is the manipulation to export in pdf
thanks
• Thu, 16 Mar 2017, 7:54 AM
Hey,
moodle version 3.1.3+ (Build: 20161202)
theme "essential" 3.1.1.4 (Build: 2016061713)
install with "Install plugins from the moodle Plugins directory"
yesterday, i could not open my lesson on edition mode ! but today it's good !!!! I dont no why, i uninstalled and reinstalled it
but i want to know What is the manipulation to export in pdf
thanks
• Fri, 24 Mar 2017, 6:08 AM
Hi, will there be a support for version 3.2?
• Fri, 24 Mar 2017, 10:34 PM
I've no reason to believe why this wouldn't work on Moodle 3.2 but I've just not tested it yet, if you have an instance and are willing to do so before I manage to get around to it then I'd be thrilled to see the result. I'm more than happy to make changes for 3.2 support though!
• Thu, 30 Mar 2017, 9:51 PM
Latest release should solve the $settingsnav issue as well as a better regex for finding elements with the class "pagebreak". Please don't put content in the elements with the pagebreak class as regular expressions are not useful for parsing HTML (it's an irregular language). I had issues whilst using the DOMDocumentFragment to manipulate pagebreaks but I will make a better effort to improve breaking in the future! • Mon, 17 Apr 2017, 2:34 AM Hey, I have a problem with special (national) characters in pdf exports, but in epub format is OK. Charset is UTF-8, czech language. In pdf file, there's symbol ? instead of the local letters ř, č or š. Can you help me ? Thanks • Wed, 19 Apr 2017, 4:19 PM Hi, i am working with Arabic lessons , when i want to export the lesson, i get it all ????? , i tried different fonts , but did not work out, is there a way to fix it or add Arabic fonts to use in the Plugins? Thanks. • Wed, 19 Apr 2017, 8:16 PM Hello, Adam. About the$settingsnav issue, I think it's related to the configuration of "Navigation block".

Thanks
• Tue, 25 Apr 2017, 4:35 PM
Hey, thanks for the heads-up! I believe that issue is now fixed. As for other languages; I've added a right-to-left optional feature and the "?" issue is a font issue. Using "freeserif" as a font-face works, but I'm working on allowing you to upload your own fonts to be used for the next release.
• 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.
• 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 https://github.com/tecnickcom/tcpdf 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!
• 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.
• 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?
• 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, http://fonts.snm-portal.com/ 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.
• Mon, 15 May 2017, 8:13 PM
Sorry, I should clarify; your Fonts directory is likely under /lib/tcpdf/fonts