I'm trying to create a pdf from my tiff image using itext5 and java11 in a springboot project. These are the dependencies:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.9</version>
<relativePath/>
</parent>
<!-- PDF Generator -->
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.5.13.3</version>
</dependency>
Following some example I'm using:
RandomAccessSourceFactory rasf = new RandomAccessSourceFactory();
RandomAccessFileOrArray myTiffFile = new RandomAccessFileOrArray(rasf.createBestSource(tiffFilepath));
to access the image file I want to add to the pdf. PROBLEM: This method doesn't implement Autocloseable, so I have to do it manually and can't use a try-with-resources. When I try to do it manually, in console I have this log:
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.itextpdf.text.io.ByteBufferRandomAccessSource$1 (file:/C:/Users/user/.m2/repository/com/itextpdf/itextpdf/5.5.13.3/itextpdf-5.5.13.3.jar) to method java.nio.DirectByteBuffer.cleaner()
WARNING: Please consider reporting this to the maintainers of com.itextpdf.text.io.ByteBufferRandomAccessSource$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
and the resource remain not closed. Do you know how to solve this and what can I use to create the pdf?