ulb-sachsen-anhalt / digital-derivans

Derive new digitals from existing ones
MIT License
6 stars 2 forks source link

Configured max dimension fails for very large Images #16

Closed M3ssman closed 2 years ago

M3ssman commented 2 years ago

Description

Actually, derivans tool is not able to handle images where width exceeds 14.400 px.

2021-10-19 16:17:17 [INFO ] ulb.migration - calling derivans with 'java -jar /home/migrator/ulb-it-migration/bin/digital-derivans-1.3.1.jar /data/migration/work_dir_worker01/968977.ulb.xml'
Exception in thread "main" ExceptionConverter: com.itextpdf.text.DocumentException: The page size must be smaller than 14400 by 14400. It's 15378.0 by 8567.0.
        at com.itextpdf.text.pdf.PdfPage.<init>(PdfPage.java:96)
        at com.itextpdf.text.pdf.PdfDocument.endPage(PdfDocument.java:1022)
        at com.itextpdf.text.pdf.PdfDocument.newPage(PdfDocument.java:942)
        at com.itextpdf.text.Document.newPage(Document.java:362)
        at de.ulb.digital.derivans.derivate.PDFDerivateer.addPages(PDFDerivateer.java:114)
        at de.ulb.digital.derivans.derivate.PDFDerivateer.create(PDFDerivateer.java:346)
        at de.ulb.digital.derivans.Derivans.create(Derivans.java:182)
        at de.ulb.digital.derivans.App.main(App.java:38)
2021-10-19 16:18:55 [ERROR] ulb.migration - Command 'java -jar /home/migrator/ulb-it-migration/bin/digital-derivans-1.3.1.jar /data/migration/work_dir_worker01/968977.ulb.xml' returned non-zero exit status 1.

(This extend also marks the maximum dimension the rendering library iText5 is capable of.) The Question here is: although there's already a maximum dimension configured, but in our case it's ignored.

Thus, it's required for derivans to pay attention to it's configuration.

adendogo commented 2 years ago

This issue is fixed by applying a new given DEFAULT_MAXIMUM of 14400 (according to iText5 constraint). Larger images will resampled before passing to iText. The setter function (setMaximal) is not accepting values greater then 14400 and complains in case with a DigitalDerivansException.