Lesson PDF Export

General plugins (Local) ::: local_lessonexport
Maintained by Adam King
This plugin allows lesson modules to be exported to PDF documents with optional protection.

Lesson PDF Export 3.0+ (Build: 2019090900)

Moodle 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8
Released: Monday, 9 September 2019, 9:39 PM

Lesson export

This plugin adds the ability to export Moodle lessons as PDF documents. Many thanks to Davo Smith for developing the original base-code this plugin was ported from.

Usage

Once the plugin is installed, you can visit a lesson, then click on the new 'Export as PDF' link that appears in the activity administration block (with javascript enabled, similar links are inserted on the top-right corner of the page).

You may also add page-breaks in the content by giving any element (in HTML) the 'pagebreak' class. This will remove the element from the content that is used as a break so be careful here. Regular expressions are used to find the pagebreak elements and as such, it's more preferable to place these on self-closing tags. If not used on self-closing tags, such as <br class="pagebreak" />, then be careful not to place content inside of those elements as the trailing close tag will not be matched.

When editing footer content in the Lesson Export settings, there are several shortcodes you may use to add useful information to the document.

Shortcode Output Notes
[pagenumber] The number of the page, per-page. This is a single integer, without additional characters.
[date] The current date at the point of the export. In the format "dd M YYYY". For example; 27 February 2017.
[coursename] The name of the course, as-is listed on Moodle. Printed without any additional characters such as punctuation.
[lessonname] The name of the lesson, as-is listed on Moodle. Printed without any additional characters such as punctuation.

Settings

There are many globally configurable options for exporting PDF documents from a lesson including;

  • Exclude page types
  • Print question answers
  • Strict mode - Throw exceptions on content errors
  • Cover photo banner colour
  • Configurable PDF protection settings
  • A user password
  • A owner password
  • A font family
  • Configurable footer content

Customising

There is a page in the plugin settings (Site Administration->Plugins->Lesson Export) with a filemanager instance for uploading custom font files in the format of TrueTypeFont(TTF) or OpenTypeFont(OTF), which will be converted automatically into a usable TCPDF font, that you may use in the native plugin settings. The name of the font is given to you when the font is uploaded as it will often differ from the filename you uploaded it as.

If you want to customise the button that exports documents, please use the class exportpdf for custom css. The outer div element with the class exportpdf is the container for an a element, which is the export link.

If you want to add your organisation's logo to the front page of the exported lesson, please replace the file local/lessonexport/pix/logo.png with your logo. Do not alter the file dimensions, it must remain 514 by 182 pixels.

Customise the following language strings, to alter the embedded export information: 'printed' - set the description on the front page 'This doucment was downloaded on [date]'

(see https://docs.moodle.org/en/Language_customization for more details)

Disclaimer

This repository is provided as-is and is open to pull requests or issues. It was developed by Adam King for use at SHEilds Health & Safety. Any development going forwards will be to abstract the plugin to match many use-cases. Please be aware that security applied to the PDF documents will not be effective if you also use the EPUB exporter for Lesson modules as EPUB has no standard security measures available at the time of development.

Version information

Version build number
2019090900
Version release name
3.0+ (Build: 2019090900)
Maturity
Stable version
MD5 Sum
b663af8737fa6774642d37dbafcae6d1
Supported software
Moodle 3.0, Moodle 3.1, Moodle 3.2, Moodle 3.3, Moodle 3.4, Moodle 3.5, Moodle 3.6, Moodle 3.7, Moodle 3.8
  • Latest release for Moodle 3.0
  • Latest release for Moodle 3.1
  • Latest release for Moodle 3.2
  • Latest release for Moodle 3.3
  • Latest release for Moodle 3.4
  • Latest release for Moodle 3.5
  • Latest release for Moodle 3.6
  • Latest release for Moodle 3.7
  • Latest release for Moodle 3.8

Version control information

Version control system (VCS)
GIT
VCS repository URL
VCS branch
master

Default installation instructions for plugins of the type General plugins (Local)

  1. Make sure you have all the required versions.
  2. Download and unpack the module.
  3. Place the folder in the "local" subdirectory.
  4. Visit http://yoursite.com/admin to finish the installation.