【问题标题】:pdfbox document is encrypted errorpdfbox 文档被加密错误
【发布时间】:2013-01-19 17:55:24
【问题描述】:

我有一个pdf document,我正在用 pdfbox 解析它。文件没有加密,我可以打开文件。但是,以下 PDFBox 中的代码行

    try
        {
            document = PDDocument.load( inpFilename);


            if( document.isEncrypted() )
            {
                System.err.println( "Error: Document is encrypted with a password." );
                return;

            }

产生错误:"Error: Document is encrypted with a password."。知道为什么会这样吗?是否有各种 pdf 加密(允许您阅读,但不能使用 pdfbox 处理)?

【问题讨论】:

  • 添加,pdfimages可以对pdf进行操作,创建图片。
  • 能够打开文档,例如在 adobe reader 中并不意味着文档未加密。不幸的是,我手头只有手机,无法检查您的 PDF,但我猜您的文档是使用默认用户密码加密的...
  • 您的链接在最初工作时允许下载两个文档,AN9780300883.pdf 和 b303635a.pdf,您对哪一个有问题?前者不加密,后者加密!

标签: pdf pdfbox


【解决方案1】:

在这里查看答案:remove encryption from pdf with pdfbox, like qpdf

向您展示如何在未指定用户密码的情况下轻松解密文档。

【讨论】:

    猜你喜欢
    • 2015-05-27
    • 1970-01-01
    • 2011-10-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-02-07
    • 2021-01-29
    相关资源
    最近更新 更多