Forums | Mahara Community
Support
/
No PDF export, maybe I am missing something?
22 December 2021, 16:56
Hi there team, this is my first post in the Mahara forums. The reason I'm writing to you in the Support subforum is because I can't seem to be able to export a Mahara portfolio in PDF format.
I'm using Mahara 21.04, on an Ubuntu 18.04 machine, in an Nginx 1.14 server, hosted inside a Moodle 3.11 instance (i.e. my Mahara files are part of the Moodle filesystem, right in the `moodle/mahara` directory). I have headless Chrome 96.0.4664.110.
It is my understanding that since Mahara 20.04 it is possible to export as PDF from Mahara. From what I've read, it's only necessary to have headless chrome, and to add the line `$cfg->usepdfexport = true;` to Mahara's configuration file. Is this it? I've done this, but I cannot export as PDF, so I think I may be missing a step.
I do know about mahara(dot)org/interaction/forum/topic.php?id=8653 and bugs(dot)launchpad(dot)net/mahara/+bug/1906123 but my issue seems to be slightly different, in that my server outputs no errors whatsoever. I've been monitoring the `event_log` table, but it does not show any PDF export errors (it only shows a login record... I did set the logging to 'All' in Configure site -> Site options -> Logging settings). I've also been monitoring the files `/var/log/nginx/error.log`, `/var/log/nginx/access.log`, and `/var/log/php_errors.log` to no avail, because none of these logs show any errors when I export my portfolio using a temp student account. Maybe I'm looking into the wrong logs? Where does Mahara output PDF exporting errors?
My Mahara configuration file is the file `moodle/mahara/config.php`, and it contains the line `$cfg->usepdfexport = true;`, I have placed several breakpoints, one breakpoint in each and every line where `$cfg->usepdfexport` is used, but none of the breakpoints is tripped during execution, which to me suggests that the flag `$cfg->usepdfexport` is being plainly ignored. I also placed a breakpoint in the line `$cfg->usepdfexport = true;` of the configuration file `moodle/mahara/config.php` and that breakpoint is tripped, so Mahara reads the value of the flag, but it never gets used in the code when I go to the URL `my.site/mahara/export/index.php` (which I access by going to Manage -> Export and then clicking on 'Generate export').
In short, have I done enough to export portfolios in PDF format? Or am I missing another step?
23 December 2021, 7:45
Hi Julian,
Welcome to the community.
Did you follow the instructions for setting up chrome as mentioned on the plugins page: 'Requires "chrome-php". You can install this via "make pdfexport"'? You only mentioned that you have headless Chrome but not whether you added the PHP extension and used the make command for the setup. Last question for Chrome: Is it installed as a Snap?
You mentioned that you log events to the database. Do you have Elasticsearch running? The event log that logs to the database doesn't log everything, but only the items that are needed for reporting purposes.
Your server should definitely have some error output, even if just for some debug messages. Please check that you have an error log configured. You should also have an access log alongside it for good measure. See the Mahara installation support page for a typical location.
Thank you
Kristina
23 December 2021, 8:36
Thank you so much Kristina for your response. Do you know where should I execute the command `make pdfexport`? I'm looking at all the Makefile files in Mahara, but in none of them I can see a target named 'pdfexport', so I wouldn't know exactly from where to execute the make command (in the documentation it only says you should execute that command, but not from where)... just for good measure, I executed `make pdfexport` directly from the root of my Mahara installation at `moodle/mahara`, but it outputs the error `make: *** No rule to make target 'pdfexport'. Stop.`. I did the same from `moodle/mahara/lib` but the same error, so at this point it would be a guessing game to know from where should I execute that command... but yeah, you are right that maybe this is what I'm missing
About my Chrome install, it does not come from Snap, it comes directly from Google, at dl(dot)google(dot)com/linux/direct/google-chrome-stable_current_amd64(dot)deb and then I installed it using `dpkg`.
About Elasticsearch, I had never heard about it before, so I'm guessing that most likely I don't have it running (I work as a dev, so my system is managed by me.. but there is a chance that my company set Elasticsearch to run as part of my dependencies.. but as far as I know, I don't have that application).
23 December 2021, 9:04
Hi there Kristina, quick update, please ignore my questions in the previous post.
I checked Mahara's source code at https://github.com/MaharaProject/mahara/, turns out that the Makefile I'm needing, the one that contains the 'pdfexport' target, is placed at the root of the project, in https://github.com/MaharaProject/mahara/blob/main/Makefile. Given that I have Mahara as part of my Moodle instance (embedded, as it were), I do not have any of these files (my Mahara files are those in `mahara/htdocs`, we rename this directory to `mahara` and place it in `moodle/mahara`, so I don't have any of the files that are upper on the file hierarchy, which includes that Makefile with the 'pdfexport' target)... do you know if doing this is wrong? Or how would you go about embedding Mahara into Moodle? My company does it this way and our clients have never complained about Mahara, so I know this works.. but maybe it doesn't work in order to build the 'pdfexport' target?
24 December 2021, 20:08
[SOLVED] I managed to get it to work. Kristina was correct, the only step I was missing was executing `make pdfexport`, so I'm writing this in case someone else has a similar situation. Because I only had the files in `htdocs`, I had to download again the same version of my Mahara, run `make all` and `make pdfexport` in the root of the downloaded directory, and then copy the `htdocs` directory to replace my `moodle/mahara`, then reinstall Mahara (drop and create the `mahara` database), enable networking, and create an Institution that allows SSO connections from my Moodle instance. Now my Mahoodle is capable of exporting to PDF, thanks Kristina for setting me in the correct path, on my own I would have never guessed that the `make pdfexport` was so vital to the process, I thought it was enough having Chrome headless, but as it turns out, `make pdfexport` downloads a specific version of Chrome headless.
10 January 2022, 13:23
Hi Julian,
I wish you a happy new year! Great that you could resolve your problem while we were on a short summer holiday break here in Aotearoa New Zealand.
As far as I know, even if you have your Mahara site installed in a subdirectory of your Moodle directory, you should still have all the files in that directory root, the one above htdocs, unless someone didn't copy them over onto the server for you.
Best,
Kristina
12 January 2022, 4:07
Hi Kristina! Happy New Year to you and your people too!! :D
Hmm in my company we don't put any of the files above htdocs in the server... for some reason that I don't really know... but yeah what you say sounds reasonable. The system still works, fortunately.
Hope you enjoyed your summer holiday break!