Hmm… PD4ML cannot estimate a number of resulting PDF pages before a render() call.

I would recommend to run a first fake conversion procedure to an ignored ByteArrayOutputStream, just to let pd4ml.getLastRenderInfo() return a number of pages. After that you can make a decision either to specify a footer or not.

A feature you need requires a test conversion pass. It makes not much difference if you run it explicitly in your code, or we hide it somewhere in PD4ML logic.