This sounds very much like the problem I'm having. Anyone have a solution?
Can you turn on debugging, and note what errors you are getting?
We are having similar wonky issues with certificates on Moodle 2.7. More often than not, it shows "failed to load PDF document" when clicking "get certificate". Try it again later that day, next day, another computer and it works, then doesn't. No rhyme or reason (other than we did an install of the BigBlueButton plugin around that same time it started getting wonky.
Turned on debugging and saw this on ours:
Exception - TCPDF ERROR: Some data has already been output, can't send PDF file
More information about this error
Error code: generalexceptionmessage
line 2912 of /lib/tcpdf/tcpdf.php: Exception thrown
line 7629 of /lib/tcpdf/tcpdf.php: call to TCPDF->Error()
line 142 of /lib/pdflib.php: call to TCPDF->Output()
line 148 of /mod/certificate/view.php: call to pdf->Output()
Output buffer: <div class="notifytiny debuggingmessage" data-rel="debugging">add_to_log() has been deprecated, please rewrite your code to the new events API<ul style="text-align: left" data-rel="backtrace"><li>line 48 of /lib/deprecatedlib.php: call to debugging()</li><li>line 51 of /mod/certificate/view.php: call to add_to_log()</li></ul></div>
Like the debugging message states: add_to_log() has been deprecated. Use the following link as reference to update your logging api: https://docs.moodle.org/dev/Migrating_logging_calls_in_plugins
This commit (https://github.com/markn86/moodle-mod_certificate/commit/4cabcba435ac9ffa318d49db41fe3d4d27245079) seem to have replaced add_to_log with events. May be try updating your certificate plugin. And like always, do a through test before deploying on your production server.