Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I had the same problem in the past. I've used <a href="http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/" rel="nofollow">pdftk tool</a> inside powershell</p> <pre><code>dir c:\ *.pdf | foreach-object { $pdf = pdftk.exe $_.FullName dump_data $NumberOfPages = [regex]::match($pdf,'NumberOfPages: (\d+)').Groups[1].Value New-Object PSObject -Property @{ Name = $_.Name FullName = $_.FullName NumberOfPages = $NumberOfPages } } | select name,fullname,numberofpages | export-csv -notypeinformation d:\list.txt </code></pre> <p>After some test I realized that I had problems when I had protected pdfs. Using <a href="http://sourceforge.net/projects/itextsharp/" rel="nofollow">itextsharp</a> I solved them</p> <pre><code>[void][System.Reflection.Assembly]::LoadFrom("c:\itextsharp\itextsharp.dll") gci -path c:\ *.pdf | foreach-object{ $itext = new-object itextsharp.text.pdf.PdfReader($_.fullname) if (-not $itext.IsEncrypted() ) { $pdf = pdftk.exe $_.FullName dump_data $NumberOfPages = [regex]::match($pdf,'NumberOfPages: (\d+)').Groups[1].Value New-Object PSObject -Property @{ Name = $_.Name FullName = $_.FullName NumberOfPages = $NumberOfPages } } else { New-Object PSObject -Property @{ Name = $_.Name FullName = $_.FullName NumberOfPages = "encrypted" } } } |Select-Object name,fullname,numberofpages | export-csv -notypeinformation d:\list2.txt </code></pre> <p>Hope that it helps.</p> <p>edit. Please note that great part of the script has been done by Shay Levy, a powershell guru :)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload