TcePdfReport

TcePdfReport API reference

class TcePdfReport extends Tcpdf

Extends: Tcpdf

Source: shared/code/tce_pdf_report.php:34

Methods

__construct()

Constructor: A4 portrait, millimetres, unicode, compressed.

public __construct()

Throws:

  • Com\Tecnick\Pdf\Font\Exception: if the default PDF font cannot be loaded.

Source: shared/code/tce_pdf_report.php:74

addReportPage()

Add a new content page and reset the content cursor below the header.

public addReportPage(): void

Source: shared/code/tce_pdf_report.php:197

defaultPageContent()

Generate the repeating page header (and an empty footer) for every page.

Invoked automatically by addPage() when enableDefaultPageContent() is on.

public defaultPageContent(int $pid = -1): string

Parameters:

  • $pid (int): Page index.

Returns: string: Raw PDF content stream prepended to the page.

Source: shared/code/tce_pdf_report.php:326

enablePageDecoration()

Enable or disable the automatic page header/footer (turn off for clean OMR scan pages).

public enablePageDecoration(bool $on): void

Parameters:

  • $on (bool): True to draw the header/footer on subsequent pages.

Source: shared/code/tce_pdf_report.php:230

outputReport()

Output the report to the browser as a downloadable PDF.

public outputReport(string $filename = 'tcexam_report.pdf'): void

Parameters:

  • $filename (string): Suggested download file name.

Source: shared/code/tce_pdf_report.php:311

printQuestionStats()

Print question statistics as an HTML table.

public printQuestionStats(array $stats, int $display_mode = 2): void

Parameters:

  • $stats (array): Data to print.
  • $display_mode (int): 2 = module; 3 = + subject; 4 = + question; 5 = + answer.

Source: shared/code/tce_pdf_report.php:485

printSVGStatsGraph()

Print an SVG statistics graph with a coloured legend.

public printSVGStatsGraph(string $svgdata): void

Parameters:

  • $svgdata (string): SVG graph data (legacy F_getSVGGraphCode input).

Source: shared/code/tce_pdf_report.php:1063

printTestResultStat()

Print the test results statistics table.

public printTestResultStat(array $data, bool $pubmode = false, int $stats = 2): void

Parameters:

  • $data (array): Test statistics.
  • $pubmode (bool): If true, filter for the public interface (hide user column).
  • $stats (int): 2 = full stats; 1 = user stats; 0 = disabled.

Source: shared/code/tce_pdf_report.php:594

printTestUserInfo()

Print the test/user info box followed by the per-question details.

public printTestUserInfo(array $data, bool $onlytext = false): void

Parameters:

  • $data (array): Testuser data.
  • $onlytext (bool): If true, print only free-text questions.

Source: shared/code/tce_pdf_report.php:746

printUserTestDetails()

Print the per-question test details for the selected user.

public printUserTestDetails(array $data, bool $onlytext = false): void

Parameters:

  • $data (array): Testuser data.
  • $onlytext (bool): If true, print only free-text questions.

Source: shared/code/tce_pdf_report.php:863

setReportHeader()

Set the page header content.

public setReportHeader(
    string $title,
    string $string = '',
    string $logo = '',
    float $logowidth = 0.0
): void

Parameters:

  • $title (string): Header title (left, bold).
  • $string (string): Header descriptive text.
  • $logo (string): Logo file name (under K_PATH_IMAGES), or empty.
  • $logowidth (float): Logo width in mm.

Source: shared/code/tce_pdf_report.php:176

Set a URL printed as a QR-Code in the page header (back-link to TCExam).

public setTCExamBackLink(string $link): void

Parameters:

  • $link (string): URL link.

Source: shared/code/tce_pdf_report.php:189

writeReportHTML()

Render an HTML block at the current cursor and advance the cursor.

The tc-lib-pdf HTML engine handles wrapping and internal page breaks.

public writeReportHTML(string $html): void

Parameters:

  • $html (string): HTML content to render.

Source: shared/code/tce_pdf_report.php:252