Printing assessments to pdf still fails with some HTML elements

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.

Attachments

1

is related to

Activity

Show:

Daniel Merino October 7, 2014 at 7:34 AM

Hudson CI Server October 6, 2014 at 2:08 PM

UNSTABLE: Integrated in sakai-trunk-java-1.7 #459 (See http://builds.sakaiproject.org:8080/job/sakai-trunk-java-1.7/459/)
printing assessment to PDF still fails with some HTML (ottenhoff@longsight.com: rev 314040)

Sam Ottenhoff October 6, 2014 at 10:43 AM

trunk commit r314040

Daniel Merino September 9, 2014 at 7:46 AM

Raúl Sánchez Vegas September 8, 2014 at 6:50 AM

Hi

I've attached the patch SAM-2392.patch to fix that bug. Could someone have a look at this patch?

Thanks,
Raúl

Fixed

Details

Priority

Affects versions

Fix versions

Components

Assignee

Reporter

Created August 26, 2014 at 5:07 AM
Updated April 17, 2018 at 8:26 AM
Resolved October 6, 2014 at 10:43 AM