使用 pdftk 一次性解密多个 PDF
我有 10 个 PDF 需要用户密码才能打开。我知道那个密码。我想以解密的格式保存它们。它们的文件名遵循以下形式: static_part.dynamic_part_like_date.pdf
我想转换所有 10 个文件。我可以在静态部分后给出一个 * 并处理所有这些,但我也想要相应的输出文件名。因此必须有一种方法来捕获文件名的动态部分,然后在输出文件名中使用它。
对一个文件执行此操作的正常方法是:
pdftk secure.pdf input_pw foopass output unsecured.pdf
我想做类似的事情:
pdftk var=secured*.pdf input_pw foopass output unsecured+var.pdf
谢谢。
I have 10 PDFs that ask for a user password to open. I know that password. I want to keep them in a decrypted format. Their filenames follow the form:
static_part.dynamic_part_like_date.pdf
I want to convert all the 10 files. I can give a * after the static part and work on all of them, but I also want the corresponding output filenames. So there has to be a way to capture the dynamic part of the filename and then use it in the output filename.
The normal way of doing this for one file is:
pdftk secured.pdf input_pw foopass output unsecured.pdf
I want to do something like:
pdftk var=secured*.pdf input_pw foopass output unsecured+var.pdf
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的要求有点含糊,但这里有一些可能对您有帮助的想法。
假设您的 10 个文件中有 1 个是
并且您只想将 SalesReport.pdf 转换为不安全的,您可以使用 shell 脚本来实现您的要求:
您可能会发现您需要修改
%.*
内容要从对于您来说,在命令行上弄清楚您需要什么确实会容易得多。
使用 1 个示例文件名设置一个变量
,然后将 echo 与变量修饰符结合使用来查看结果。
等。
另请注意我如何将修改后的变量值与纯字符串 (.pdf) 结合起来,在
unsecuredName=${file%%.*}.pdf
IHTH
Your request is a little ambiguous, but here are some ideas that might help you.
Assuming 1 of your 10 files is
And you want only the SalesReport.pdf converted as unsecured, you can use a shell script to achieve your requirement:
You may find that you need to modify the
%.*
thing toIt will really be much easier for you to figure out what you need at the cmd-line.
Set a variable with 1 sample fileName
and then use echo combined with the variable modifiers to see the results.
etc.
Also notice how I combine a modified variable value with a plain string (.pdf), in
unsecuredName=${file%%.*}.pdf
IHTH