Actions

Proposals/Done/PDF Export

From Mahara Wiki

< Proposals‎ | Done

PDF export was implemented as experimental feature in Mahara 20.04.

Preamble

One barrier to adoption of Mahara in schools is that it doesn't provide a hard copy of the 'Views' where the evidence of learning is displayed. Some assessors and verifiers insist this is available for marking.

Developing the functionality to download a view as a PDF serves as a solution to this.

Implementation

It is not necessary to create the PDF functionality from scratch as the wkhtmltopdf open source utility already exists. So only an interface is needed within Mahara for this.  This might be developed as another export plugin type which would allow for more flexibility if later iterations required more features etc.

The user will have the option to print only a single view at a time for the initial version of PDF export. This can be done either from the view page itself via a link at the bottom of the page or from the My Portfolio/Export page.

A simplified template for the PDF view will be created. This will remove certain elements of the view that aren't necessary in a hard copy such as editing links, site navigation, collection navigation, feedback input boxes etc. This view might either be implemented using CSS, in much the same way as the existing print functionality, or with the use of blocktype functions similar to the render_self functionality like default view rendering. Or both.

This means that we can control the printing of non-static items such as “Wall posts” to display in a nicer format and remove unnecessary elements like input boxes if they exist. Downloadable files will be stripped off 'Download' links and the details content could be moved to the main listing instead. 'Blog' and 'External feed' instances could only print the number of posts set in their configuration and not print any pagination links etc. Likewise for anything else that has a 'limit' attached.

If using the render_pdf solution then like the existing render_self function the parent blocktype class will have a default simplified version for those blocktypes that don't specify their own. This will simply print the title of the element and will serve mostly to preserve the views basic layout structure for columns where no other printable format for an element exists.

Using this simplified view we can also offer the user a 'Preview of the view as it is going to be printed in PDF. Clicking on the 'Export to PDF' button from the view or Export page will take the user to a separate page and display this compiled view. The user can then confirm the export or return back to the previous page.

Technical details

PDF export must interface with the wkhtmltopdf utility which means that the code will have to check this is installed before offering the 'Export to PDF' option to users. Further to this there will be an administration option for enabling/disabling this functionality for all users.

There will be a new config record for determining the status of PDF export within the site – enabled/disabled.