Commit Graph
43 Commits
Author SHA1 Message Date
Roberto Rosario 2f3d640799 Convert: Move initalization of Pillow
Pillow was being initialized on import. This commit
moves the initialization to the __init__ method of the
Python backend subclass.

Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
2018-12-08 16:33:35 -04:00
Roberto Rosario 8e69178e07 Project: Switch to full app paths
Instead of inserting the path of the apps into the Python app,
the apps are now referenced by their full import path.

This app name claves with external or native Python libraries.
Example: Mayan statistics app vs. Python new statistics library.

Every app reference is now prepended with 'mayan.apps'.

Existing config.yml files need to be updated manually.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
2018-12-05 02:04:20 -04:00
Roberto Rosario 5c1eb59a1a Converter: Rename setting
Change the CONVERTER_GRAPHICS_BACKEND_CONFIG settings
to CONVERTER_GRAPHICS_BACKEND_ARGUMENTS for uniformity
and to convey it real purpose which is initializing a backend.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
2018-11-26 17:39:48 -04:00
Roberto Rosario d5224d93a7 Settings: Remove support for quoted settings
Instead of passing strings as arguments to backends, all settings must
be formatted according to YAML specifications. This is to remove the
need to add separate YAML parsing to each backend argument in each
app that needs it. Argument passing to backends is not fully
uniform.

Users need to update their config files.
  Example:

    DOCUMENTS_STORAGE_BACKEND_ARGUMENTS: '{location: /home/rosarior/development/mayan-edms/mayan/media/document_storage}'

  must be changed to:

    DOCUMENTS_STORAGE_BACKEND_ARGUMENTS:
      location: /home/rosarior/development/mayan-edms/mayan/media/document_storage

  Example 2:

    CONVERTER_GRAPHICS_BACKEND_CONFIG: '        {            libreoffice_path: /usr/bin/libreoffice,            pdftoppm_dpi:
    300,            pdftoppm_format: jpeg,            pdftoppm_path: /usr/bin/pdftoppm,            pdfinfo_path:
    /usr/bin/pdfinfo,            pillow_format: JPEG        }    '

  must be changed to:

    CONVERTER_GRAPHICS_BACKEND_CONFIG:
      libreoffice_path: /usr/bin/libreoffice
      pdftoppm_dpi: 300
      pdftoppm_format: jpeg
      pdftoppm_path: /usr/bin/pdftoppm
      pdfinfo_path: /usr/bin/pdfinfo
      pillow_format: JPEG

  Example 3:

    OCR_BACKEND_ARGUMENTS: ''

  must be changed to:

    OCR_BACKEND_ARGUMENTS: {}

  Settings that need to be updated are:

  - COMMON_SHARED_STORAGE_ARGUMENTS
  - CONVERTER_GRAPHICS_BACKEND_CONFIG
  - DOCUMENTS_CACHE_STORAGE_BACKEND_ARGUMENTS
  - DOCUMENTS_STORAGE_BACKEND_ARGUMENTS
  - OCR_BACKEND_ARGUMENTS
  - SIGNATURES_STORAGE_BACKEND_ARGUMENTS
  - SOURCES_STAGING_FILE_CACHE_STORAGE_BACKEND_ARGUMENTS

  The following error will appear in the console if a setting is not yet
  updated to this new format::

      TypeError: type object argument after ** must be a mapping, not str

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
2018-11-26 17:27:57 -04:00
Roberto Rosario 9dba40a1d8 Use BytesIO instead of StringIO. Use text_type instead of unicode.
Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
2017-08-29 02:12:18 -04:00
Roberto Rosario b6ffeaeb32 Allow changing the output format, DPI of the pdftoppm command, and
the output format of the converter via the CONVERTER_GRAPHICS_BACKEND_CONFIG
setting sub options: pdftoppm_dpi: 300, pdftoppm_format: jpeg, pillow_format: jpeg
GitHub issues #256 #257 GitLab issue #416.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
2017-08-03 01:10:39 -04:00
Roberto Rosario 28b4c9a546 Add workaround for PDF with IndirectObject as the
rotation value. GitHub #261.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
2017-07-30 04:17:23 -04:00
Roberto Rosario 6dc45a1c7f Allow encrypted PDF total page number instrospection to work
when PDF has non ASCII user properties. GitLab issue #411.
Thanks to @corneliusludmann for the report and investigation.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
2017-07-22 02:45:18 -04:00
Roberto Rosario 7343223f59 PDF compatibility improvements. Support simple encrypted PDF.
Improve PDF page count detection. Improve PDF orientation
detection. Merge CONVERTER_LIBREOFFICE_PATH and
CONVERTER_PDFTOPPM_PATH config settings into
CONVERTER_GRAPHICS_BACKEND_CONFIG.
GitLab issue #384 #376 #377.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
2017-07-04 04:02:29 -04:00
Roberto Rosario 4150fea2ad Add PDF orientation detection. Closes GitLab issue #387.
Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
2017-06-16 22:30:07 -04:00
Roberto Rosario 945158bd60 Normalize handling of temporary file and directory creation. 2016-06-23 20:54:10 -04:00
Roberto Rosario 26fce66451 Change pngtoppm to convert PDFs to JPEG instead of PNGs. 2016-03-21 03:49:11 -04:00
Roberto Rosario 923ecc85d8 PEP8 Cleanups. 2015-10-28 02:22:10 -04:00
Roberto Rosario a76a8b7e0a Reset pointer before attemping a conversion. 2015-10-07 03:17:02 -04:00
Roberto Rosario dbd676646b Don't convert images blindly to RGB. Only convert to RGB or RGBA when saving to JPEG and mode is 'P'. documents.tests.test_models.MultiPageTiffTestCase passes again. 2015-09-16 15:56:10 -04:00
Roberto Rosario d6a3111d69 Make sure all images are converted to RGB before processing. 2015-09-15 02:01:56 -04:00
Roberto Rosario 2f030ab162 Properly raise PageCountError when unable to determine a document's page count. 2015-08-06 02:57:02 -04:00
Roberto Rosario 1361ea9b42 Remove dependency on slate to calculate page number in PDF files. 2015-07-31 02:09:10 -04:00
Roberto Rosario 3b728328ad PEP8 cleanups, E501. 2015-07-23 04:05:29 -04:00
Roberto Rosario 3d7e7ae4a2 Add support for getting an office document page count. 2015-07-03 03:19:42 -04:00
Roberto Rosario debd9db317 Remove graphicsmagic and imagemagick backends 2015-07-02 20:48:44 -04:00
Roberto Rosario 956ca08cbd Fix converter backend 2015-06-27 23:32:52 -04:00
Roberto Rosario b18888b3f7 Convert and cache office documents at the document version level for faster page image retrieval 2015-06-24 01:04:35 -04:00
Roberto Rosario 78198f3398 Smart settings refactor 2015-06-22 21:04:06 -04:00
Roberto Rosario 32fe03aaa7 PEP8 clean up and trivial typo fixes 2015-06-08 15:54:54 -04:00
Roberto Rosario d678431c97 Move transformation storage to the converter app via content types 2015-06-08 15:53:25 -04:00
Roberto Rosario b256758db2 Implement class based converter transformations 2015-06-07 05:29:31 -04:00
Roberto Rosario f4752a3f3f Further converter refactor and initial move from document-centric to page-centric image generation. Issue #93. 2015-06-06 06:26:44 -04:00
Roberto Rosario de6182aea0 Initial commit of the converter refactor 2015-06-05 03:35:07 -04:00
Roberto Rosario f4d3767b15 PEP8 cleanup, remove unused imports, fix permission check when removing metadata from a document 2015-01-26 19:17:35 -04:00
Roberto Rosario b55acb6e12 Normalize import style 2015-01-24 17:05:32 -04:00
Roberto Rosario d59ea3ede2 Add from __future__ import unicode_literals, issue #37 2015-01-19 04:06:40 -04:00
Roberto Rosario aca9d8c9eb Remove unused imports, do PEP8 and DeprecationWarning cleanups 2015-01-05 14:40:59 -04:00
Roberto Rosario 76fc6c091f Remove all direct use of ghost script, add PDFTOPPM_PATH to allow configurable pdftoppm path, raise ConvertError on coverterror and not UnknownFile exception blindly 2014-11-18 04:46:24 -04:00
Roberto Rosario ed11e242ca Issue #23, Experiment with pdftoppm 2014-11-18 00:35:56 -04:00
Roberto Rosario d65cd68aec Fix base class argument count 2014-11-02 21:26:24 -04:00
Roberto Rosario 97dcf507ab PEP8 cleanups 2014-10-08 18:14:05 -04:00
Roberto Rosario 9012a1101a Merge branch 'feature/remove_non_essentials' into development
Conflicts:
	mayan/apps/converter/__init__.py
	mayan/apps/converter/api.py
	mayan/apps/converter/views.py
	mayan/urls.py
2014-10-01 22:22:06 -04:00
Roberto Rosario 7f62831c37 Issue #56, Remove the "Supported File Format" list view, messages and related code 2014-10-01 22:19:08 -04:00
Roberto Rosario b761037d99 Move all settings files from <app>/conf/settings.py to <app>/settings.py 2014-09-11 05:02:40 -04:00
Roberto Rosario a9390d55ba Unify the way backends are defined and loaded, unify the fs_cleanup function 2014-07-01 00:22:31 -04:00
Roberto Rosario 0209d13150 Change quotation char usage, remarked code cleanups 2014-06-25 02:22:11 -04:00
Roberto Rosario ec1745b50b Initial changes to support the new Django 1.6 project structure 2014-06-15 13:13:21 +02:00