0

context: jdk11, springboot, itextpdf 5.5.13.3, ubuntu, eclipse

during: new HtmlPipelineContext(null); throughout new CssAppliersImpl(new XMLWorkerFontProvider()); and last CssAppliersImpl(){// map builder inside } appears

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.itextpdf.text.io.ByteBufferRandomAccessSource$1 (file:/home/awieclawski/.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

question: how to avoid it?

PS. Before HtmlPipelineContext instance is established:

        CSSResolver cssResolver = new StyleAttrCSSResolver();
        cssResolver.addCss(cssFile);
 //     cssFile is returned from XMLWorkerHelper.getCSS(getCssStream(path));
    }

and at the debug of new HtmlPipelineContext(null); is signalized: com.sun.jdi.ClassNotLoadedException: Type has not been loaded occurred invoking method.

solution:

there is problematic line (503) in FontFactoryImp where static method BaseFont.enumerateTTCNames(path); is called. To avoid this in XMLWorkerFontProvider constructor should be used XMLWorkerFontProvider.DONTLOOKFORFONTS as parameter value.

XMLWorkerFontProvider fontProvider = new XMLWorkerFontProvider(XMLWorkerFontProvider.DONTLOOKFORFONTS); `

it's quite enough - problem disappeared :)

  • itext5 is end of life. Perhaps this answers your question? [Itext Java 11: Illegal reflective access by com.itextpdf.io.source.ByteBufferRandomAccessSource$1](https://stackoverflow.com/questions/53301158/itext-java-11-illegal-reflective-access-by-com-itextpdf-io-source-bytebufferran) – DuncG May 13 '23 at 07:42
  • thx, but solution is found :) – Andrzej Więcławski May 13 '23 at 12:33

0 Answers0