I've got this pretty interesting task of inserting some data on PDFs for users just before they got their files from Moodle.
Although the first use is not a very brilliant, it adds some personal user info to files to users are "discouraged" to share the contents of a course as they will share it with their email addres, phone number, and "idmsn", it can be used to more "noble" cases.
So i am sharing this in the hope you like =)
Here is the full commit at the moment:
Note that it uses composer to add two pdf libraries (pdfi works on top of fdpf), so you need to do "composer update" to get this working.
Also, it patches directly the "lib/filelib.php" just before it sends the Content-Length but after sending E-Tags. I would like to do that on the mod_resource_fileplugin but could not figure out a way to get a $file object from a temporary file created on a temporary directory, but I guess it is because I should use the file API to add the file instead of directly write to temporary directory.
As always, suggestions, improvements, doubts any any comments are welcome =)