Tests & Quizzes (Samigo): download pdf / unreadable file

Description

If a question includes the following in the source code, the download pdf function within Print will not download/open the file properly.

<span style="font-size:larger">

or

<span style="font-size: small;">

Error: There was an error opening this document. The file is damaged and could not be repaired.

Activity

Show:

Mark Golbeck September 24, 2024 at 2:48 PM

is this still an issue in current versions of Sakai?

Matthew Jones May 25, 2017 at 7:24 AM

Yeah, Sakai uses the old 2.1.7 because after that the license changed to an incompatible license. (AGPL)
https://en.wikipedia.org/wiki/IText

It looks like a fork, OpenPDF was released a few months ago https://mvnrepository.com/artifact/com.github.librepdf/openpdf / https://github.com/LibrePDF/OpenPDF which I'm betting would require some work to migrate to. I believe there's also Apache's PDFBox that a few tools are using which would basically require a complete rewrite. (Though maybe even OpenPDF would too)

Raúl Sánchez Vegas May 25, 2017 at 4:55 AM

Hi all

The issue is still happening in Sakai 11 and 12.x. Taking into account that the bug is in the itext library I believe the best solution would be to update the library: Nowadays Sakai has the version 2.1.7 whereas the current version is itext 7.0.2. What do you think about?

Matthew Jones October 7, 2015 at 2:35 PM

This also has a problem if the size is a number like this tag

<span style="font-size: 14.0px;"

The error is in the itext library so it might not be possible to fix this unless this attributed is cleaned out prior to passing it into this library, Or maybe we could look if any alternative libraries would be better. (No more updates to itext since 2009)

2015-10-05 18:09:18,158 INFO http-nio-8080-exec-5 org.sakaiproject.tool.assessment.ui.bean.print.PDFAssessmentBean - starting PDF generation
java.lang.IllegalArgumentException: Element not allowed.
at com.lowagie.text.pdf.ColumnText.addElement(Unknown Source)
at com.lowagie.text.pdf.PdfPCell.addElement(Unknown Source)
at org.sakaiproject.tool.assessment.ui.bean.print.PDFAssessmentBean.getStream(PDFAssessmentBean.java:935

Details

Priority

Affects versions

Assignee

Reporter

Labels

Environment

Trunk

Created April 23, 2014 at 1:10 PM
Updated September 24, 2024 at 2:48 PM