You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by "Brangs, Erik" <E....@dnb.de> on 2025/12/08 09:18:01 UTC

Text extraction fails because permissions are not recognized

Hi,

I'm trying to extract text from the PDF at https://d-nb.info/1015222862/34 using PDFBox 3.0.6 with bouncycastle. My code uses canExtractContent() from AccessPermission to check if text extraction should be attempted. When attempting to extract text, PDFBox fails with "IOException: java.io.IOException: Provided decryption material is not compatible with the document - did you pass a null keyStore?". The problem also occurs with PDFBox 4.0.0-SNAPSHOT.

Adobe Acrobat can open the PDF. According to its permission display, assembly and extraction of pages is not permitted. I also tried opening the document with PDF-XChange Viewer. PDF-XChange Viewer cannot open the document and displays an error message that says "Error [PDF Structure 40]: Unknown/unsupported security handler".

Is my check for text extraction wrong or incomplete?


-- 
Erik Brangs
Deutsche Nationalbibliothek
Fachbereich Metadaten | IT
Adickesallee 1
60322 Frankfurt am Main
Telefon: +49 69 1525-1850
Telefax: +49 69 1525-1799
mailto:e.brangs@dnb.de
https://www.dnb.de


Re: Text extraction fails because permissions are not recognized

Posted by Marc Kaufman <ka...@cs.stanford.edu>.
This is part of Portfolios, in that the cover page is not encrypted but 
files in the portfolio can be encrypted (individually), so that only 
users with the right credentials can see the included file. You are 
right in thinking this is not a common use case.

Acrobat: The roach motel of features. Features go in, but never come out.

Marc

On 12/8/2025 6:04 AM, Tilman Hausherr wrote:
> Hi,
>
> PDFBox fails with an error message related to a missing certificate, 
> Firefox and Chrome are unable to display it, Adobe displays it but 
> mentions "Zertifikatssicherheit", PDF-XChange mentions something about 
> a digital ID.
> From what I see it is a special case that we don't support: 
> DefEmbeddedFile which means that only the embedded files are 
> encrypted. Overwriting the references to the encryption directory with 
> blanks (there are two) makes it possible to display with PDFBox. So 
> your document is legit but uses an exotic feature.
>
> Tilman 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


AW: Text extraction fails because permissions are not recognized

Posted by "Brangs, Erik" <E....@dnb.de>.
Hi,

thank you. Then I'll leave my code as it is.

> -----Ursprüngliche Nachricht-----
> Von: Tilman Hausherr [mailto:THausherr@t-online.de]
> Gesendet: Montag, 8. Dezember 2025 15:05
> An: users@pdfbox.apache.org
> Betreff: Re: Text extraction fails because permissions are not recognized
> 
> Hi,
> 
> PDFBox fails with an error message related to a missing certificate,
> Firefox and Chrome are unable to display it, Adobe displays it but
> mentions "Zertifikatssicherheit", PDF-XChange mentions something about a
> digital ID.
>  From what I see it is a special case that we don't support:
> DefEmbeddedFile which means that only the embedded files are encrypted.
> Overwriting the references to the encryption directory with blanks
> (there are two) makes it possible to display with PDFBox. So your
> document is legit but uses an exotic feature.
> 
> Tilman
> 
> Am 08.12.2025 um 10:18 schrieb Brangs, Erik:
> > Hi,
> >
> > I'm trying to extract text from the PDF at https://d-nb.info/1015222862/34 using
> PDFBox 3.0.6 with bouncycastle. My code uses canExtractContent() from
> AccessPermission to check if text extraction should be attempted. When attempting to
> extract text, PDFBox fails with "IOException: java.io.IOException: Provided decryption
> material is not compatible with the document - did you pass a null keyStore?". The
> problem also occurs with PDFBox 4.0.0-SNAPSHOT.
> >
> > Adobe Acrobat can open the PDF. According to its permission display, assembly and
> extraction of pages is not permitted. I also tried opening the document with PDF-
> XChange Viewer. PDF-XChange Viewer cannot open the document and displays an
> error message that says "Error [PDF Structure 40]: Unknown/unsupported security
> handler".
> >
> > Is my check for text extraction wrong or incomplete?
> >
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org


Re: Text extraction fails because permissions are not recognized

Posted by Tilman Hausherr <TH...@t-online.de>.
Hi,

PDFBox fails with an error message related to a missing certificate, 
Firefox and Chrome are unable to display it, Adobe displays it but 
mentions "Zertifikatssicherheit", PDF-XChange mentions something about a 
digital ID.
 From what I see it is a special case that we don't support: 
DefEmbeddedFile which means that only the embedded files are encrypted. 
Overwriting the references to the encryption directory with blanks 
(there are two) makes it possible to display with PDFBox. So your 
document is legit but uses an exotic feature.

Tilman

Am 08.12.2025 um 10:18 schrieb Brangs, Erik:
> Hi,
>
> I'm trying to extract text from the PDF at https://d-nb.info/1015222862/34 using PDFBox 3.0.6 with bouncycastle. My code uses canExtractContent() from AccessPermission to check if text extraction should be attempted. When attempting to extract text, PDFBox fails with "IOException: java.io.IOException: Provided decryption material is not compatible with the document - did you pass a null keyStore?". The problem also occurs with PDFBox 4.0.0-SNAPSHOT.
>
> Adobe Acrobat can open the PDF. According to its permission display, assembly and extraction of pages is not permitted. I also tried opening the document with PDF-XChange Viewer. PDF-XChange Viewer cannot open the document and displays an error message that says "Error [PDF Structure 40]: Unknown/unsupported security handler".
>
> Is my check for text extraction wrong or incomplete?
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org