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.
Java
Result result = pdfReactor.Convert(config); int numberOfPages = result.NumberOfPagesLiteral;
C#
Result result = pdfReactor.convert(config); int numberOfPages = result.getNumberOfPagesLiteral();
PHP
$result = $pdfReactor->convert($config); $numberOfPages = $result->numberOfPagesLiteral;
JavaScript/Node.js
const result = await pdfReactor.convert(config); const numberOfPages = result.numberOfPagesLiteral;
Python
result = pdfReactor.convert(config) numberOfPages = result["numberOfPagesLiteral"]
Ruby
result = pdfReactor.convert(config) numberOfPages = result["numberOfPagesLiteral"]
Perl
$result = $pdfReactor->convert($config); $numberOfPages = $result->{numberOfPagesLiteral};