Symptoms
When planning a task it can be usefult to know how many total pages you'll find in a collection of PDF files.
Cause
n/a
Resolution
The pdfinfo tools is a useful CLI utility to use with Windows/Powershell. Windows and Linux versions can be downloaded from: https://www.xpdfreader.com/download.html
Example use:
$folder = 'C:\Test' $Total = $Files = 0 foreach($File in (Get-ChildItem -Path $Folder -Filter *.pdf)){ $Pages = (pdfinfo $File.FullName | Select-String -Pattern '(?<=Pages:\s*)\d+').Matches.Value $Total += $Pages $Files++ [PSCustomObject]@{ PdfFile = $File.Name Pages = $Pages } } "`nTotalNumber of pages: {0} in {1} files" -f $Total,$Files
And output:
PdfFile Pages ------- ----- 2014-02-25_Allwinner A80.pdf 1 test.pdf 4 TotalNumber of pages: 5 in 2 files
Source: https://superuser.com/questions/1446208/counting-total-number-of-pages-across-multiple-pdf-files-on-the-windows-powersh
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article