Refactors PdfDataLister buffering.

Fixes #5400