Plugin: Test2PDF: Fix images paths #4181

pull/4219/head
Angel Fernando Quiroz Campos 4 years ago
parent de948e4225
commit 571d2e6193
  1. 7
      main/inc/lib/pdf.lib.php
  2. 7
      plugin/test2pdf/src/download-pdf.php

@ -957,13 +957,8 @@ class PDF
/** /**
* Fix images source paths to allow export to pdf. * Fix images source paths to allow export to pdf.
*
* @param string $documentHtml
* @param string $dirName
*
* @return string
*/ */
private static function fixImagesPaths($documentHtml, array $courseInfo, $dirName = '') public static function fixImagesPaths(string $documentHtml, array $courseInfo, string $dirName = ''): string
{ {
$documentHtml = '<?xml encoding="utf-8" ?>'.$documentHtml; $documentHtml = '<?xml encoding="utf-8" ?>'.$documentHtml;
$doc = new DOMDocument(); $doc = new DOMDocument();

@ -32,7 +32,12 @@ $pdf->SetFont('Arial', '', 16);
$pdf->SetTextColor(64); $pdf->SetTextColor(64);
$pdf->MultiCell(0, 7, $infoQuiz['title'], 0, 'L', false); $pdf->MultiCell(0, 7, $infoQuiz['title'], 0, 'L', false);
if (!empty($infoQuiz['description'])) { if (!empty($infoQuiz['description'])) {
$pdf->WriteHTML(removeQuotes($infoQuiz['description'])); $pdf->WriteHTML(
PDF::fixImagesPaths(
removeQuotes($infoQuiz['description']),
$infoCourse
)
);
} }
// Select all questions of the supported types from the given course // Select all questions of the supported types from the given course

Loading…
Cancel
Save