Refactored code in export_pdf.php

Refactored code in export_pdf.php in order to separate
the parts which write the scores table and the coments
table.