Uploaded image for project: 'Sakai'
  1. Sakai
  2. SAK-35732

Printing assessments to pdf still fails with some HTML elements

    XMLWordPrintable

    Details

    • 10 status:
      Resolved
    • Previous Issue Keys:
      SAM-2392

      Description

      In SAM-1106 it was fixed an issue when printing to pdf an assessment with HTML text which includes font changes.

      We have found a happening of this issue not covered by the patch, related to PdfPTable objects.

      The Description/Intro element in "Assessment Introduction" in Settings can be set as HTML and with a font-style medium or large it throws the Exception.

      The involved code at PDFAssessmentBean.java is:

      public ByteArrayOutputStream getStream() {
      (...)
      //parse out the elements from the html
      ArrayList elementBuffer = HTMLWorker.parseToList(safeReader(head.toString()), style, props);
      float[] singleWidth =

      {1f}

      ;
      PdfPTable single = new PdfPTable(singleWidth);
      single.setWidthPercentage(100f);
      PdfPCell cell = new PdfPCell();
      cell.setBorderWidth(0);
      for (int k = 0; k < elementBuffer.size(); k++)

      { cell.addElement((Element)elementBuffer.get(k)); }

      single.addCell(cell);
      (...)
      document.add(single);
      document.add(Chunk.NEWLINE);

      The Element object is not processed by FormattedText and it also crashes.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  ottenhoff Sam Ottenhoff
                  Reporter:
                  daniel.merino Daniel Merino Echeverría
                • Votes:
                  1 Vote for this issue
                  Watchers:
                  5 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:

                    Git Source Code