Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positive on "Secured pdf file" detection #743

Closed
CedCannes opened this issue Oct 14, 2024 · 3 comments
Closed

False positive on "Secured pdf file" detection #743

CedCannes opened this issue Oct 14, 2024 · 3 comments

Comments

@CedCannes
Copy link

  • PHP Version: 8.1
  • PDFParser Version: 2.11

Description:

The parser is incorrectly identifying a non-secured PDF as secured, preventing it from being read. The PDF in question can be opened and read without any password or security measures using various PDF readers (Adobe Acrobat, Chrome PDF viewer, etc.). There are no apparent security features enabled on this PDF, suggesting this is a false positive in the library's security detection mechanism.

PDF input

The PDF file can be found at: https://www.lacameraembarquee.fr/img/cms/fiches-produit/DJINeo-manuel.pdf

Expected output & actual output

Expected output: The PDF content should be successfully extracted.
Actual output: An exception is thrown with the message: "Secured pdf file are currently not supported."

Code

use Smalot\PdfParser\Parser;

        $parser = new Parser();
        try {
            $pdf = $parser->parseFile($pdfPath);
            $pdfText = $pdf->getText();
            ...
@k00ni
Copy link
Collaborator

k00ni commented Oct 15, 2024

@k00ni k00ni added the stale needs decision label Oct 15, 2024
@unixnut
Copy link
Contributor

unixnut commented Nov 14, 2024

It's very likely that this file is encrypted, but with an empty passphrase. Try the pdfinfo tool from the 'poppler-utils' (Debian package or https://pypi.org/project/poppler-utils/ ).

See #320 .

@CedCannes
Copy link
Author

Yes, I have saved the file again and it works correctly

@k00ni k00ni removed the stale needs decision label Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants