opensagres / xdocreport

XDocReport means XML Document reporting. It's Java API to merge XML document created with MS Office (docx) or OpenOffice (odt), LibreOffice (odt) with a Java model to generate report and convert it if you need to another format (PDF, XHTML...).
https://github.com/opensagres/xdocreport
1.23k stars 375 forks source link

Replace dependency com.lowagie:itext:2.1.7 with OpenPDF latest version #634

Open stefan-dan opened 9 months ago

stefan-dan commented 9 months ago

Hello there,

I'm using this XWPF convertor to convert .doc files to .pdf.

The latest version 2.0.4 is using this vulnerable dependency: com.lowage:itext:2.1.7.

I'm also using JasperReports, which recently switch from iText 2.1.7 to LibrePDF/OpenPDF.

Because I'm using both XWPF convertor and JasperReports, there is a clash between the dependencies and I have to exclude com.lowage:itext:2.1.7 dependency.

Are there any plans for XWPF convertor to switch to OpenPDF?

BishopWolf commented 8 months ago

I am getting this error because of this issue

WARNING: Illegal reflective access by com.lowagie.text.pdf.MappedRandomAccessFile$1 (file:/~/.m2/repository/com/lowagie/itext/2.1.7/itext-2.1.7.jar) to method java.nio.DirectByteBuffer.cleaner()

Is there any way to circunvent it?

stefan-dan commented 8 months ago

@BishopWolf try this workaround.

Otherwise try to exclude the com.lowagie dependecy, here is an example using Gradle:

implementation 'fr.opensagres.xdocreport:fr.opensagres.poi.xwpf.converter.pdf:2.0.4', { exclude group: 'com.lowagie' }

and then add the OpenPDF dependency:

implementation 'com.github.librepdf:openpdf:2.0.1'