After converting a document you can use the properties numberOfPagesLiteral and numberOfPages of the Result object to retrieve the number of pages of the final PDF or of the laid out input document without any postprocessing.

Result result = pdfReactor.convert(config);
int numberOfPages = result.getNumberOfPagesLiteral();