In 3.0 the context is set in the constructor. But your problem is a
different one, that "resources" is null.
It would be interesting to find out whether this happens in ordinary
text extraction. If not, please share minimal code that reproduces this,
and the PDF where it happens (or does it happen with any PDF?)
Tilman
Am 27.11.2025 um 21:28 schrieb Mark Gibson:
Hi
We have some old code that extended PDFTextStripper using PDFBox v2. Recently tried to
upgrade to PDFBox v3 (tried 3.03 and 3.06). We get a Null exception thrown from
SetFontAndSize operator. It looks like "resources" is null.
PDFont font = context.getResources().getFont(fontName);
Tracing through the code in V2, I see that PDFStreamEngine.processOperator()
used to call processor.setContext(this). That sets the context.resources to a
non null value.
In V3, there is no call to processor.SetContext(this).
Can anyone the context of why this was removed, and the expectations for user
code to resolve the null reference?
Many thanks
Mark