tcexam icon indicating copy to clipboard operation
tcexam copied to clipboard

cannot generate pdf offline exam

Open ravituduru opened this issue 3 years ago • 3 comments

I have installed the tcexam in xampp server but when i try to create the offline exam using pdf. It is throwing the error below ATTENTION: [8192] Required parameter $length follows optional parameter $start | LINE: 190 | FILE: /opt/lampp/htdocs/tcexam-develop/shared/code/tce_functions_general.php ATTENTION: [8192] Required parameter $currentfont follows optional parameter $isunicode | LINE: 1998 | FILE: /opt/lampp/htdocs/tcexam-develop/shared/tcpdf/include/tcpdf_fonts.php ATTENTION: [8192] Required parameter $currentfont follows optional parameter $isunicode | LINE: 2024 | FILE: /opt/lampp/htdocs/tcexam-develop/shared/tcpdf/include/tcpdf_fonts.php ATTENTION: [8192] Required parameter $currentfont follows optional parameter $setbom | LINE: 2040 | FILE: /opt/lampp/htdocs/tcexam-develop/shared/tcpdf/include/tcpdf_fonts.php ATTENTION: [8192] Required parameter $currentfont follows optional parameter $setbom | LINE: 2060 | FILE: /opt/lampp/htdocs/tcexam-develop/shared/tcpdf/include/tcpdf_fonts.php ATTENTION: [8192] Required parameter $currentfont follows optional parameter $str | LINE: 2077 | FILE: /opt/lampp/htdocs/tcexam-develop/shared/tcpdf/include/tcpdf_fonts.php ATTENTION: [8192] Required parameter $currentfont follows optional parameter $str | LINE: 2093 | FILE: /opt/lampp/htdocs/tcexam-develop/shared/tcpdf/include/tcpdf_fonts.php ATTENTION: [8192] Required parameter $tagvspaces follows optional parameter $default_css | LINE: 1139 | FILE: /opt/lampp/htdocs/tcexam-develop/shared/tcpdf/include/tcpdf_static.php ATTENTION: [8192] Required parameter $k follows optional parameter $points | LINE: 2510 | FILE: /opt/lampp/htdocs/tcexam-develop/shared/tcpdf/include/tcpdf_static.php TCPDF ERROR: Some data has already been output, can't send PDF file

May I know how to resolve above error.

ravituduru avatar Feb 22 '21 10:02 ravituduru

Me too, I have this error from the newest tcexam apps

ATTENTION: [8] Trying to access array offset on value of type null | LINE: 586 | FILE: /var/www/html/tcexam/admin/code/tce_pdf_testgen.php ATTENTION: [8] Trying to access array offset on value of type null | LINE: 586 | FILE: /var/www/html/tcexam/admin/code/tce_pdf_testgen.php ATTENTION: [8] Trying to access array offset on value of type null | LINE: 586 | FILE: /var/www/html/tcexam/admin/code/tce_pdf_testgen.php ATTENTION: [8] Trying to access array offset on value of type null | LINE: 586 | FILE: /var/www/html/tcexam/admin/code/tce_pdf_testgen.php ATTENTION: [8] Trying to access array offset on value of type null | LINE: 586 | FILE: /var/www/html/tcexam/admin/code/tce_pdf_testgen.php ATTENTION: [8] Trying to access array offset on value of type null | LINE: 586 | FILE: /var/www/html/tcexam/admin/code/tce_pdf_testgen.php ATTENTION: [8] Trying to access array offset on value of type null | LINE: 586 | FILE: /var/www/html/tcexam/admin/code/tce_pdf_testgen.php

jgun98vpn4 avatar Dec 18 '21 05:12 jgun98vpn4

ERROR: [2] Cannot modify header information - headers already sent by (output started at /var/www/html/tcexam/shared/code/tce_functions_errmsg.php:86) | LINE: 7709 | FILE: /var/www/html/tcexam/shared/tcpdf/tcpdf.php TCPDF ERROR: Some data has already been output to browser, can't send PDF file

jgun98vpn4 avatar Dec 18 '21 05:12 jgun98vpn4

Any solution? I have the same issue here with TCExam 14.8.5 on PHP 7.4. Every time I try to generate the PDF file I get:

ATENÇÃO: [8] Trying to access array offset on value of type null | LINE: 586 | FILE: /simulados/admin/code/tce_pdf_testgen.php ATENÇÃO: [8] Trying to access array offset on value of type null | LINE: 586 | FILE: /simulados/admin/code/tce_pdf_testgen.php ATENÇÃO: [8] Trying to access array offset on value of type null | LINE: 586 | FILE: /simulados/admin/code/tce_pdf_testgen.php ATENÇÃO: [8] Trying to access array offset on value of type null | LINE: 586 | FILE: /simulados/admin/code/tce_pdf_testgen.php ATENÇÃO: [8] Trying to access array offset on value of type null | LINE: 586 | FILE: /simulados/admin/code/tce_pdf_testgen.php ERRO: [2] Cannot modify header information - headers already sent by (output started at /simulados/shared/code/tce_functions_errmsg.php:86) | LINE: 7709 | FILE: /simulados/shared/tcpdf/tcpdf.php TCPDF ERROR: Some data has already been output to browser, can't send PDF file

hpflatorre avatar Mar 07 '22 15:03 hpflatorre

We're still running 14.8.5 on PHP 7.4 and I have "rediscovered" this issue. @nicolaasuni has this fixed in v15, and the fix for that can apply just as easily to v14.8.5 - see the patch below:-

--- /usr/share/tcexam-14.1.9/admin/code/tce_pdf_testgen.php     2018-11-29 10:24:30.000000000 +0000
+++ /usr/share/tcexam-14.8.5/admin/code/tce_pdf_testgen.php     2023-08-09 15:48:01.448435075 +0100
@@ -583,7 +583,7 @@
                     if ($ra = F_db_query($sqla, $db)) {
                         if ($ma = F_db_fetch_array($ra)) {
                             $rightanswer = '';
-                            if ($mq['question_type'] == 4) {
+                            if ($q['type'] == 4) {
                                 $rightanswer = $ma['answer_position'];
                             } elseif (F_getBoolean($ma['answer_isright'])) {
                                 $rightanswer = 'X';

pantsmanuk avatar Aug 09 '23 14:08 pantsmanuk

Please ensure you are using the latest TCExam version as the older versions may contain other bugs and security issues.

nicolaasuni avatar Dec 20 '23 08:12 nicolaasuni