Damage pdf file

Hello,

I found a bug in the Mayan application. I add a new pdf file using document upload wizard, the file is uploaded, but when I enter the document details, there is no preview.

What could be the reason for the above error?

Hi,

In order to diagnose the issue there please answer the following questions:

  • What installation method was used?
  • Does the error happen with other file formats?
  • What version did you installed?
  • Can you provide the error logs?

Hi,

** What installation method was used?*

  • Direct installation

** Does the error happen with other file formats?*

  • The error occurs only on some pdf files. Other types I did not check, because only pdf documents are downloaded to the system

** What version did you installed?*

  • Version 4.2.10

** Can you provide the error logs?*

2023-03-07 08:41:25,885 mayan.apps.converter.backends.python <4533> [ERROR] "get_page_count() line 122 e[31;1mException determining PDF page count; only algorithm code 1 and 2 are supported. This PDF uses code 4e[0m"
Traceback (most recent call last):
  File "/opt/mayan-edms/lib64/python3.6/site-packages/PyPDF2/_reader.py", line 443, in _get_num_pages
    self.decrypt("")
  File "/opt/mayan-edms/lib64/python3.6/site-packages/PyPDF2/_reader.py", line 1723, in decrypt
    return self._decrypt(password)
  File "/opt/mayan-edms/lib64/python3.6/site-packages/PyPDF2/_reader.py", line 1764, in _decrypt
    % encrypt["/V"]
NotImplementedError: only algorithm code 1 and 2 are supported. This PDF uses code 4

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/mayan-edms/lib64/python3.6/site-packages/mayan/apps/converter/backends/python.py", line 99, in get_page_count
    page_count = pdf_reader.getNumPages()
  File "/opt/mayan-edms/lib64/python3.6/site-packages/PyPDF2/_reader.py", line 466, in getNumPages
    return self._get_num_pages()
  File "/opt/mayan-edms/lib64/python3.6/site-packages/PyPDF2/_reader.py", line 446, in _get_num_pages
    raise PdfReadError("File has not been decrypted")
PyPDF2.errors.PdfReadError: File has not been decrypted

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/mayan-edms/lib64/python3.6/site-packages/mayan/apps/converter/backends/python.py", line 109, in get_page_count
    pdf_reader.decrypt(password=b'')
  File "/opt/mayan-edms/lib64/python3.6/site-packages/PyPDF2/_reader.py", line 1723, in decrypt
    return self._decrypt(password)
  File "/opt/mayan-edms/lib64/python3.6/site-packages/PyPDF2/_reader.py", line 1764, in _decrypt
    % encrypt["/V"]
NotImplementedError: only algorithm code 1 and 2 are supported. This PDF uses code 4
NotImplementedError: only algorithm code 1 and 2 are supported. This PDF uses code 4

This indicates that the PDFs are encrypted and the encryption algorithm is not supported. Without decryption Mayan cannot access the content of the files for page count introspection, image generation, text extraction.

Direct installation

The direct installation method is deprecated, try using the Docker Compose method. All dependencies are managed and there is the chance that a new version of PyPDF might be able have support for the encryption algorithms.

Version 4.2.10

Likewise try a more recent version of Mayan. Series 4.2 is already in maintenance mode and will be end-of-life when version 4.5 sometime during this year.

Thank you for your reply. I uploaded the pdf file to the trial version of Mayan EDMS available at: Mayan EDMS and the program displayed the pdf file correctly. Apparently, the problem is caused by the direct installation method.

Thank you for your help!

All good

1 Like

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.