Since error suppression was removed with the call to unlink() to make
sure that there are no previous test image files before testing for the
gs path, make sure that it exists first before deleting to prevent it
from throwing any errors.
When a pdf object is instantiated and any file is loaded
with set_pdf() or load_pdf(), the files remain open until
the pdf is saved with pdf_save() or outputted with Output()..
In that cases is needed to perform an explicit Close() in
order to free resources, parsers and, ultimately, fclose()
the files.
Note that only the uses detected in the editpdf unit tests have
been fixed. I'd recommend to analyse every instance of the tcpdf
libs.
Also, there was one incorrecly reused pdf instance in then
generate_combined_pdf_for_attempt() method. Apparently it was not
leading to problems, but better use a separate instance (#246).
AMOS BEGIN
MOV ['gspath','assignfeedback_editpdf'],['pathtogs','admin']
MOV ['gspath_help','assignfeedback_editpdf'],['pathtogs_help','admin']
AMOS END
This includes a check to see if there are 0 pages in the combined pdf,
catching exceptions and suppressing php warnings and errors from bad pdf files.
Also - Use TCPDF directly to check if pdfs are compatible. The previous check was
letting dodgy PDFs through which then failed at generation time. This way dodgy
pdfs will get run through ghostscript early and cleaned up.
It was possible for user to add widgets with width/height = 0
which were not displayed to user and doesn't have much meaning to it
This patch will set min. width/height to 1