View Single Post
Old 07-16-2020, 01:48 PM   #7
j.p.s
Grand Sorcerer
j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.j.p.s ought to be getting tired of karma fortunes by now.
 
Posts: 5,823
Karma: 104662271
Join Date: Apr 2011
Device: pb360
I did a bit of looking around and found a couple more ways to do it.

1. qpdf gives a bit cleaner results.
Code:
for f in *.pdf; do qpdf --show-encryption $f > /dev/null; done
2. For those like me that find perl easier to read and write than python
Code:
#!/usr/bin/perl
use PDF::API2;

while (glob "*.pdf") {
  $pdf = PDF::API2->open($_);
  print "$_ is encrypted.\n" if $pdf->isEncrypted();
}
PDF::API2 was not included by default on any of my systems, but neither was PyPDF2 including on a very large anaconda install of python at work.
j.p.s is offline   Reply With Quote