I recently updated the xhtmlrenderer library in my Java project. After the update, I started getting an error related to the ITextUserAgent constructor in my FileResolvingUserAgent class. The error message is as follows:

error: constructor ITextUserAgent in class ITextUserAgent cannot be applied to given types;
required: ITextOutputDevice,int
found:    ITextOutputDevice
reason: actual and formal argument lists differ in length

Here is the code for my FileResolvingUserAgent class:

public FileResolvingUserAgent(final ITextOutputDevice outputDevice, final Map<String, Supplier<InputStream>> fileResolvers) {
    this.fileResolvers = fileResolvers;

And here is the constructor for ITextUserAgent:

public ITextUserAgent(ITextOutputDevice outputDevice, int dotsPerPixel) {
    super(Configuration.valueAsInt("xr.image.cache-capacity", 32));
    this._outputDevice = outputDevice;
    this.dotsPerPixel = dotsPerPixel;

It seems that the ITextUserAgent constructor now requires an additional int parameter dotsPerPixel, which wasn’t required before the update. I’m unsure what value I should pass for dotsPerPixel. Could anyone provide guidance on how to resolve this issue? Any help would be greatly appreciated. Thank you.

I tried to update the xhtmlrenderer library in my Java project. After the update, I attempted to run my project as usual.

I’m currently unsure about the appropriate value to pass for dotsPerPixel in the super(outputDevice, /* appropriate dotsPerPixel value */); line of my FileResolvingUserAgent class. I was expecting the xhtmlrenderer library update to be backward compatible, or at least have clear documentation on handling such changes. Any guidance on how to resolve this issue would be greatly appreciated. Thank you.

New contributor

maher is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.