hellerbarde/stapler

password required for unprotected PDFs

Opened this issue · 0 comments

moedn commented

I'm trying to modify or merge (tried both) unprotected PDFs. However, stapler will require a password which I cannot deliver since it doesn't exist.

e.g.

pdf-stapler sel 1.pdf 1-3 2.pdf 1-4 3.pdf 1-2 4.pdf 1-3 5.pdf 1-2 6.pdf 1-3 7.pdf 1-3 8.pdf 1-4 9.pdf 1-3 10.pdf 1-3 11.pdf 1-3 12.pdf 1-3 13.pdf 1-4 output.pdf

returns

Please enter a password to decrypt 1.pdf.
(The password will not be shown. Press ^C to cancel).
-->

When I just hit enter (as suggested by #59 ) an error follows:

Traceback (most recent call last):
  File "/usr/bin/pdf-stapler", line 33, in <module>
    sys.exit(load_entry_point('stapler==1.0.0rc1', 'console_scripts', 'pdf-stapler')())
  File "/usr/lib/python3.9/site-packages/staplelib/__init__.py", line 12, in main
    stapler.main()
  File "/usr/lib/python3.9/site-packages/staplelib/stapler.py", line 116, in main
    modes[mode](args)
  File "/usr/lib/python3.9/site-packages/staplelib/commands.py", line 25, in select
    filesandranges = iohelper.parse_ranges(args[:-1])
  File "/usr/lib/python3.9/site-packages/staplelib/iohelper.py", line 103, in parse_ranges
    "pdf": read_pdf(inputname),
  File "/usr/lib/python3.9/site-packages/staplelib/iohelper.py", line 38, in read_pdf
    matched = pdf.decrypt(pw)
  File "/usr/lib/python3.9/site-packages/PyPDF2/pdf.py", line 1987, in decrypt
    return self._decrypt(password)
  File "/usr/lib/python3.9/site-packages/PyPDF2/pdf.py", line 1996, in _decrypt
    raise NotImplementedError("only algorithm code 1 and 2 are supported")
NotImplementedError: only algorithm code 1 and 2 are supported

when I try modifying a single PDF, e.g.

'pdf-stapler del 2.pdf 4`

I get the exact same error:

Please enter a password to decrypt 2.pdf.
(The password will not be shown. Press ^C to cancel).
--> 
Traceback (most recent call last):
  File "/usr/bin/pdf-stapler", line 33, in <module>
    sys.exit(load_entry_point('stapler==1.0.0rc1', 'console_scripts', 'pdf-stapler')())
  File "/usr/lib/python3.9/site-packages/staplelib/__init__.py", line 12, in main
    stapler.main()
  File "/usr/lib/python3.9/site-packages/staplelib/stapler.py", line 116, in main
    modes[mode](args)
  File "/usr/lib/python3.9/site-packages/staplelib/commands.py", line 74, in delete
    return select(args, inverse=True)
  File "/usr/lib/python3.9/site-packages/staplelib/commands.py", line 25, in select
    filesandranges = iohelper.parse_ranges(args[:-1])
  File "/usr/lib/python3.9/site-packages/staplelib/iohelper.py", line 103, in parse_ranges
    "pdf": read_pdf(inputname),
  File "/usr/lib/python3.9/site-packages/staplelib/iohelper.py", line 38, in read_pdf
    matched = pdf.decrypt(pw)
  File "/usr/lib/python3.9/site-packages/PyPDF2/pdf.py", line 1987, in decrypt
    return self._decrypt(password)
  File "/usr/lib/python3.9/site-packages/PyPDF2/pdf.py", line 1996, in _decrypt
    raise NotImplementedError("only algorithm code 1 and 2 are supported")
NotImplementedError: only algorithm code 1 and 2 are supported

I'm using Fedora 34, pdf-stapler from the official repositories