Probably it is caused by BODY bottom margin, which does not fit the page.

Try to add
BODY { margin-bottom: 0; margin-top: 0 }
to the document styles.

With something like
BODY { border: 1 solid tomato }
you could temporarily check where is the bottom content/whitespaces edge of the page.

If your input HTML documents are read-only, the styles can be added with pd4ml.addStyle() API call.