One of the most annoying lack in Moodle: Printing a quiz to pdf

One of the most annoying lack in Moodle: Printing a quiz to pdf

by Pablo Ferrer -
Number of replies: 21

Hi,

I can't understand how after almost 18 years this simple functionality is not yet implemented in Moodle. There are many situations where having a printable pdf version of the quiz and its solutions is a must for a teacher or even the students, i.e. for analyzing the results, studying or reviewing them offline.

It could be done via the web browser directly, there are some workarounds out there which allow printing a quiz directly from the browser (as a regular website document), but after: repaginating all the questions in one page, creating a false quiz attempt, highlighting by hand the questions on the browser, and with an unoptimized format for a printable version, wasting many pages as the result. Being the quiz layout good for watching on the screen but not for printing, it's unbelievable there isn´t an useful solution yet as a Moodle feature or plugin.

Also, if a teacher needs just the correction layout (the relationship between questions and their right answer, i.e. 1:A, 2:C, 3:B, etc. it's impossible to have it in a single page without wasting once again unnecessary time, space and pages.

It would be a great solution having a "Print to PDF" button at the quiz page which outputs a PDF with the questions and answers and the last page with the list of solutions.

I am not an expert in Moodle development, but I guess the approach for having a simple "Print to PDF" button within the quiz page, would be using the same function that brings out the array of questions and answers within the quiz, and then formatting this list using an external library like pdflib.php

Really, no user or developer of Moodle sees it necessary to implement this feature?

Best Regards.

Average of ratings:Useful (2)
In reply to Pablo Ferrer

Re: One of the most annoying lack in Moodle: Printing a quiz to pdf

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Don't take this wrong, but why? In the ten years I used Moodle before retiring, I NEVER gave the same quiz to more than one person due to Moodle's question randomization and answer shuffle capability. That was one of the things that made me switch from what I was using, over to Moodle, was that I could use a large quiz bank, and give a quiz to each student that randomly selected from the question bank and shuffled the answers. The first week of school each year, I literally had students walk around and look at the first quiz generated for each of them. No two were ever the same! So, for PDF's in my lab of 16 computers, I would need to print 16 PDF's times six periods and then also keep track of which student got which version of the test. This would have been a huge waste of time and paper and require lots of file cabinets, and I just did not have a budget for that.
Don't get me wrong, I archived each school year and could show you the results for any student, any year, any quiz, any activity, for the previous five years, up until I retired. Plus, on the computer I could look results up faster, than I ever could have in a paper file.
For various reasons over the years, I have "pawed" through the database and code for questions and quizzes, and really do NOT think that it would be possible to have, "a simple "Print to PDF" button within the quiz page."
Average of ratings:Useful (3)
In reply to AL Rachels

Re: One of the most annoying lack in Moodle: Printing a quiz to pdf

by Pablo Ferrer -

Thank you for your answer,

Everything ok, but in my case which I don't think it's something outstanding, I own an academy for students which are training for some third party external exams that will have the 1 question with 4 answers quiz format. 

That's why they will need them in an external PDF, because they can unenroll from my academy when they want, and if they have no access to my platform, they can't see all that archived quizzes and the rest of the resources. Except they will print via the web browser that ugly HTML lists directly from the site.

Finally, I don't understand what's the problem implementing just a simple "Print to PDF" button. I am about 10 years of experience as Moodle teacher/user, I'm in love with it, but one of the general lack of this platform is the clean or accurately formatted printing formats, specially the quizzes, with many questions and answers, but also many elements like tables, buttons, etc. which are not necessary in a printed format and create huge documents. If that format would be cleaner, it would fit many more questions per page than 3 or 4. And if you think for example on disabled people, you would better understand what I'm talking about.

Best Regards.

Average of ratings:Useful (1)
In reply to Pablo Ferrer

Re: One of the most annoying lack in Moodle: Printing a quiz to pdf

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Ok, but still, why not teach them that when they are on the quiz review page, right click and select, Save Page As...? After they do so, use Windows explorer and navigate to where they saved the quiz review to their computer, double click the file and open in their browser. No need to print as they will have the exact same view they saw while logged in to Moodle. At least, it works that way for me.
Average of ratings:Useful (4)
In reply to Pablo Ferrer

Re: One of the most annoying lack in Moodle: Printing a quiz to pdf

by Dave Balch -
> I don't understand what's the problem implementing just a simple "Print to PDF" button.

Every feature costs something to build and maintain. If people strongly want a feature, they create it and look after it.
If there's a simple, widely available way of getting pretty much the same results (in this case using "Save as" or "Print" from the browser), often the cost isn't worth it for the expected benefit.

If one person wants/needs a feature but it doesn't fit with the general philosophy of the project (e.g. working on dead trees, when Moodle is primarily concerned with online operation), it may not get a lot of support.

If your feature to produce PDF quizes was added, it might raise other requests/expectations that take it further from it's intended mission - e.g. Why can't it scan and grade printed out manually filled-in quizes? Why can't it create fillable PDF Form quizes, then consume and grade them? These might be cool ideas, but they'd take time/money/effort whilst not neccessarily matching Moodle's core goals.

You're welcome to open an issue and create/fund a patch to add a "Print to PDF" button. It might or might not get merged, but you'd have the functionality that you want - that's part of the beauty of Open Source! smile

Average of ratings:Useful (2)
In reply to Pablo Ferrer

Re: One of the most annoying lack in Moodle: Printing a quiz to pdf

by Matt Bury -
Picture of Particularly helpful Moodlers Picture of Plugin developers
Hi Pablo,
I think I understand your needs. I work with blended learning courses & there's sometimes a need for students to take invigilated tests/exams, in person, on paper. Yes, having a printing optimised format for Moodle Quizzes would be a nice feature but for me it's not such a big deal because the tests/exams are designed on word processor documents first, for easy review & editing, e.g. to make sure the test is well-balanced (according to the curriculum & stated learning objectives), the items, distractors, etc., are well-designed & reasonably valid (Moodle's item analysis tools are great for evaluating test facility, reliability, & distractor efficiency too!) As a result, it's relatively easy to adapt the test design documents into printable test/exam papers, so in my mind & for the use-case scenarios that I'm familiar with, it doesn't seem to warrant the time & ongoing expense of maintaining a plugin for that.

Having said that, I have had clients who've expressed an interest in using Moodle to automatically generate tests/exams to print out but have been put off by the lack of a printer-friendly page layout option.

Just my €0.02!
Average of ratings:Useful (1)
In reply to Matt Bury

Re: One of the most annoying lack in Moodle: Printing a quiz to pdf

by Pablo Ferrer -

Hi Matt,

You hit the nail on the head. That´s exactly what we were doing for a long time: creating the quizzes in a well done Word layout, then formatting the quiz into Aiken and then uploading it into Moodle. 

To avoid time consuming we would like to create the Aiken directly, import the questions and answers and then, if needed, print the quizzes with the same look as our Word template.

But even further, as Moodle has the feature to create random quizzes, combine questions from several categories, etc. print those kind of quizzes too.

I am asking here just if this idea could create some interest of being implemented, after trying it with some developer at Freelancer.com with no results. Anyway I will keep searching the way to implement it by myself with external help, if someone would know how to do it without breaking Moodle.

Best Regards.

In reply to Pablo Ferrer

Re: One of the most annoying lack in Moodle: Printing a quiz to pdf

by Eoin Campbell -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

The Offline Quiz plugin is able to generate PDFs containing quiz questions. As I understand it, each student would have their own specific PDF file with random questions. They can only be printed by the Teacher role, though.

The Microsoft Word File Import/Export (Question Format) plugin has a Word template for creating questions available for download at http://www.moodle2word.net. The template contains a command to re-format questions for printing and using as a paper-based quiz.

Average of ratings:Useful (4)
In reply to Eoin Campbell

Re: One of the most annoying lack in Moodle: Printing a quiz to pdf

by Pablo Ferrer -
Hi Eoin,

Thank you so much for showing me both plugins, and congratulations for the moddle2word development.

The Offline Quiz looks great, it's a complete solution for institutions that make their exams offline. But it's out of the scope of what I need: it is designed to create offline quizzes directly, not printing regular Moodle quizzes.

Regarding moodle2word the documentation I have found only explains hoy to import questions from the Word template into Moodle, but not printing/exporting a quiz into Word. Could you help me out with these instructions, please?

Best Regards.
In reply to Pablo Ferrer

Re: One of the most annoying lack in Moodle: Printing a quiz to pdf

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers
I understand the desire for a "print to PDF" feature, and have seen this requested many times before. In my own case, having used Moodle for 12 years, and with quizzes being a major component, I have never had a need for "print to PDF" nor has any student ever asked me for it.

I view Moodle as a web product, which uses web pages. So when someone wants something printed, it puzzles me. But, as I have said, I understand the need. But I also understand the moodle programmers not seeing the need for "printed" items. And one feature, as Dave mentioned, produces other (perhaps equally) important features, such as "upload answers from PDF." Hmmm, I guess the "print to PDF" feature should produce an (advance) PDF file where students could click on radio buttons, have fill-in-the-blank features, etc., and then this PDF file should be able to be uploaded into Moodle and automatically transfer the answers. I think you see what I mean.

(And why not "print to MS Word?)

Maybe Eoin has pointed to a solution.

Yes, Moodle's quiz engine, and especially creating questions, is quite powerful. I could see using it as a stand-alone question/test generating solution. But maybe this is not the market that Moodle is seeking. There are a number of stand-alone question/quiz software products. Many years ago, I used ExamView. In fact, I used to use ExamView to manage question banks, and then export them to XML which could be imported into Moodle. But I much more like Moodle's current methods of creating questions. (I still have ExamView5 on a virtual PC. It sometimes does a good job importing questions from MS Word files, then exporting as Moodle XML.)

Well, my comments are not meant to "argue" the topic, rather I am just providing some of my perspectives.
Average of ratings:Useful (3)
In reply to Pablo Ferrer

Re: One of the most annoying lack in Moodle: Printing a quiz to pdf

by Iphigenia Symeonidis -
Hi,

There is also the option in the attempt review page to "CTRL+P" which will give the option to print to a pdf (rather than an html page). I have used this quite a lot mostly for archiving or versioning or getting external reviewers to sign off on a specific question set at a given point in time. It formats quite nicely.

If you have set up your attempt to display answer keys, you can start a quiz, submit it with not answering anything, and then, the review of your attempt will contain all your programmed answers. You can then CTRL + P into a pdf and share with your teachers (it won't fit on one page, but its quick way to generate a answer key reference). If your course is live, you can do this in a back-up of the course or if you don't want to back up, you can set up a hidden section from the students (just make sure adding this "bogus" quiz doesn't affect your gradebook if you are using it)

I hope this helps,
Iphi
Average of ratings:Useful (2)
In reply to Iphigenia Symeonidis

Re: One of the most annoying lack in Moodle: Printing a quiz to pdf

by John Provasnik -
Picture of Particularly helpful Moodlers Picture of Testers

Following up on this, you can add css that is specific to Printing the Page with Control C. This will let your printable version be able to be styled differently than your web version. 

In reply to John Provasnik

Re: One of the most annoying lack in Moodle: Printing a quiz to pdf

by John Provasnik -
Picture of Particularly helpful Moodlers Picture of Testers

I played a little on the Moodle 3.10 demo site and came up with this CSS that hopefully is a starting point for your needs. I've attached 2 screenshots - (1) a quiz in preview mode, and (2) a Print Preview using Command/Control + P


/* 3.10 Boost Theme "Clean Quiz" Print Page */

@media print {

/* Removes Page Outline and Border */

#page-mod-quiz-attempt #region-main {

    border: 0 solid;

    padding: 0;

 }

/* Removes Breadcrumb Trail, Footer, and To Top Button*/

#page-mod-quiz-attempt #page-header, 

#page-mod-quiz-attempt aside,

#page-mod-quiz-attempt #goto-top-link, 

#page-mod-quiz-attempt .activity-navigation {

  display: none;

 }

/* Cleans the Question Info Box */

#page-mod-quiz-attempt .info {

  background: transparent; 

  border: 0 solid; 

  margin-bottom: 0;

 }

/* Hide items in the Question Info Box */

#page-mod-quiz-attempt .state, 

#page-mod-quiz-attempt .grade, 

#page-mod-quiz-attempt .questionflag {

  display: none; 

 }

/* Cleans the Question Answer Box */

#page-mod-quiz-attempt .que .formulation {

  background-color: transparent;

  border-color: transparent;

 }

/* Remove items in the Question Answer Box */

#page-mod-quiz-attempt .editor_atto, 

#page-mod-quiz-attempt input {

  display: none!important;

 }

}


Attachment Print Preview.png
Attachment Quiz Preview.png
Average of ratings:Useful (3)
In reply to John Provasnik

Re: One of the most annoying lack in Moodle: Printing a quiz to pdf

by Beatriz Rojo -
Hello John,
this is great, thanks for sharing. Now here comes my simple question since I use CSS very carefully and usually, I cannot undo anything if I mess up. This long string has to be added to the Raw SCSS field in Site administration>Appearance>Themes>Boost>Advanced Settings.
Is that right?
In reply to Beatriz Rojo

Re: One of the most annoying lack in Moodle: Printing a quiz to pdf

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers
I am using Boost.

I tried John's code by adding it into Admin | Appearance | Boost | Advanced Setting, and then in the Raw SCSS dialog box. It worked fine. I don't think it matters if it is added at the top or at the bottom. I am not a CSS expert, but I think this @media print {... is additive.
Average of ratings:Useful (1)
In reply to John Provasnik

Re: One of the most annoying lack in Moodle: Printing a quiz to pdf

by John Provasnik -
Picture of Particularly helpful Moodlers Picture of Testers
And 1 other thought, you can also use css to add content that only appears on your print out. Example (to be added inside the code from my previous post): 

/* Add Additional Content to Page only when Printing  */
#page-mod-quiz-attempt #region-main::before {
  content: "Name: ___________________________________________";
}
Attachment Insert.png
Average of ratings:Useful (2)
In reply to John Provasnik

Re: One of the most annoying lack in Moodle: Printing a quiz to pdf

by Pablo Ferrer -
Wow!

Thank you very much John, and also Iphigenia and the rest. This solution could be a good one without coding, but formatting, I will give it a try!
In reply to John Provasnik

Re: One of the most annoying lack in Moodle: Printing a quiz to pdf

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers
Pretty cools stuff, John. I will be giving this a try soon to see how well it works.

I always like to make some addition comments in css code. So I would suggest something like:

/* 3.10 Boost Theme "Clean Quiz" Print Page
From John Provasnik, 1/5/2021.
https://moodle.org/mod/forum/discuss.php?d=416060#p1677066
*/
Average of ratings:Useful (1)
In reply to Pablo Ferrer

Re: One of the most annoying lack in Moodle: Printing a quiz to pdf

by Pablo Ferrer -
Hi again,

Thank you everybody for your help.

I have been investigating which tables, relationships and fields are involved for showing up the questions and answers that belong to a quiz. Also where is the right answer data stored.

Let me know your opinion, wouldn't be possible creating an external script without modifying the actual Moodle code (i. e. a plugin), to get these data from the database and then populate this data via some open source library like HTML2PDF (or FPDF), to make the layout and get the PDF file?

I have attached a couple of documents about my expected layout, which is easy to do via CSS and HTML2PDF. 

But as I'm not a Moodle expert developer, and here is where I would need some help, or maybe I would write that code like a bull in a china shop. 

Probably, this script is already made in some Moodle file for showing up the questions of the selected quiz, but I haven't found where exactly.

Moodle tables involved

Quiz title
mdl_quiz > id, name

Questions that belongs to the quiz
mdl_quiz_slots > id, questionid

Question text
mdl_question > id, question-text

Question answers texts and the right answer
mdl_question_answers > id, question (id), answer (text), fraction = 1 (the right answer)


Thank you one more time.


In reply to Pablo Ferrer

Re: One of the most annoying lack in Moodle: Printing a quiz to pdf

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
As others have said, there are plugins for this already existing. You can add https://moodle.org/plugins/quiz_answersheets to the other ones already mentioned.
Average of ratings:Useful (4)
In reply to Tim Hunt

Re: One of the most annoying lack in Moodle: Printing a quiz to pdf

by Pablo Ferrer -
Hi Tim,

Thank you so much for your contribution, I'll check quiz_answersheets which seems to have the simple feature of showing the quiz q/a in a printable format.

Best Regards.