pdf - powershell - 检查pdf是否加密

标签 pdf powershell

使用powershell我需要循环一系列pdf文件并使用pdftk对它们进行一些操作。我想知道是否存在某种方法来检测 pdf 是否加密。这样,如果 pdf 被加密,我就不会对其进行处理,并且我的循环会跳到下一个文件。感谢您的关注。

编辑。当我等待答案时,我发现 itextsharp 有一个 isencrypted 方法。

加载程序集后

[System.Reflection.Assembly]::LoadFrom("c:\my_path\itextsharp.dll")

我需要做什么才能使用上述方法?

最佳答案

[System.Reflection.Assembly]::LoadFrom("c:\itext\itextsharp.dll")

$itext = new-object itextsharp.text.pdf.PdfReader("c:\itext\1.pdf")

$itext.isEncrypted()

结果应该是 true 或 false。

关于pdf - powershell - 检查pdf是否加密,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3742584/

相关文章:

javascript - pdfMake javascript pdf内容放错位置

pdf - 使用 Ghostscript 为 postscript 文件中的某些页面添加双面选项

Powershell 过滤器 csv

azure - 通过 PowerShell 在消耗计划上创建 Azure 函数失败

powershell - 使用Powershell为AD中的每个用户检索管理器名称

python - 从PDF文件Python 2.7解码QR码

android - 如何在 Android 中阅读 PDF?

html - 缩放以适合 : PDF Embedded in HTML

powershell - 如何使用 Powershell 验证保留 IP

powershell - 如何在PowerShell中使变量成为范围?