I need to submit a PDF to an online submission portal that searches the plaintext PDF file for the page count in order to verify that it has the correct number of pages.

PdfTeX by default compresses the page tree node of generated PDF documents which contains the page count of the PDF document. This node is not usually compressed by other word processing packages.

Is there a way to generate a PDF document from LaTeX that leaves this page count information uncompressed?

  • 1
    That online submission portal is plainly stupid if it assumes it could reliably search any arbitrary PDF as plaintext for its page counts. Tell that portal to use a tool like pdfinfo to reliably verify a PDF's page count instead of stupidly fiddling with text strings inside a binary file format: 'pdfinfo some.pdf | grep ^Pages:' Dec 21, 2018 at 0:44

1 Answer 1


pdfTeX supports object stream compression in order to reduce the resultant PDF file sizes. You can disable this object stream compression in the preamble so that the resultant PDF file leaves the page count uncompressed in the plain-text:


Alternatively, before version 1.5 PDF's did not implement object stream compression. You can therefore set a flag in the preamble to force pdfTeX to generate PDF 1.4 compatible documents, which will achieve the same thing:


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .