Giter VIP home page Giter VIP logo

Comments (1)

GitHubRulesOK avatar GitHubRulesOK commented on June 7, 2024

That's in effect impossible as you need to run a file utility request (they must open the file to read the contents)
PDF page entries are stored in a semi-random set of numbered entries so it is possible for 2 entries from different times to only produce 1 page and also in rare cases a single page spawn another. However you will not know until the file is decrypted (if locked) or when scripts are running.

There are many command line tools like PDFinfo to report a calculated guess based on the raw count of KIDS entries, but they may not be true in 100% of all cases, all such tools will need to process a file from first to last byte. So usually its a slow task, unless they stored a set of counts from previous runs, like a database.

Here one single PDF has other PDFs nested inside it so the GhostScript count is unverified as to the total number of pages combined. image

Either you run windows FindStr to look for the page count texts (if not encrypted) or a command line tool like GhostScript to show calculated number of pages that it finds by silent running through all the entries.

HOWEVER just like DocX there are files where the number of pages will change when the contents are running live in screen. This is common with Forms that self adjust especially scripted XFA ones which SumatraPDF does not run.

Above GS-estimate is based on script

@echo off 
color cF & MODE CON: COLS=40 LINES=12 & title "%~n1.pdf" number of pages 
cd /d "%~dp1"
"%~dp0\gswin32c.exe" -q -dBATCH -dPDFINFO "%~n1.pdf" 2>%temp%\output.txt
findstr  "has" %temp%\output.txt
pause
del %temp%\output.txt

from sumatrapdf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.