Bastian Germann has proposed merging lp:~bastian-germann/openlp/pymupdf into lp:openlp.
Commit message: Add PyMuPDF as additional PDF controller Requested reviews: OpenLP Core (openlp-core) For more details, see: https://code.launchpad.net/~bastian-germann/openlp/pymupdf/+merge/366749 PyMuPDF itself is GPLv3+ licenced. However, MuPDF is AGPLv3+ licenced. You can argue that calling the executable via subprocess does not make OpenLP a derivative work of MuPDF, however, using the library this argument does not hold. So if the new code is used, people running OpenLP with PyMuPDF have to comply with AGPLv3+. That means the source code of the actual running MuPDF has to be provided to remote users (if there are any). For the original MuPDF versions this is done by MuPDF's authors. If someone has changes to MuPDF, these changes would have to be provided via a network service to remote users. People who have private changes to MuPDF will probably know about their obligations. As a reminder I used agpl-pdf as a keyword for the dependency. -- Your team OpenLP Core is requested to review the proposed merge of lp:~bastian-germann/openlp/pymupdf into lp:openlp.
=== modified file 'openlp/plugins/presentations/lib/pdfcontroller.py' --- openlp/plugins/presentations/lib/pdfcontroller.py 2019-04-13 13:00:22 +0000 +++ openlp/plugins/presentations/lib/pdfcontroller.py 2019-05-01 09:29:24 +0000 @@ -34,6 +34,12 @@ if is_win(): from subprocess import STARTUPINFO, STARTF_USESHOWWINDOW +try: + import fitz + PYMUPDF_AVAILABLE = True +except ImportError: + PYMUPDF_AVAILABLE = False + log = logging.getLogger(__name__) PDF_CONTROLLER_FILETYPES = ['pdf', 'xps', 'oxps'] @@ -151,8 +157,10 @@ return True elif self.gsbin: return True - else: - return False + elif PYMUPDF_AVAILABLE: + self.also_supports = ['xps', 'oxps'] + return True + return False def kill(self): """ @@ -276,6 +284,16 @@ '-r{res}'.format(res=resolution), '-dTextAlphaBits=4', '-dGraphicsAlphaBits=4', '-sOutputFile={output}'.format(output=temp_dir_path / 'mainslide%03d.png'), str(self.file_path)], startupinfo=self.startupinfo) + elif PYMUPDF_AVAILABLE: + log.debug('loading presentation using PyMuPDF') + pdf = fitz.open(str(self.file_path)) + for i, page in enumerate(pdf, start=1): + src_size = page.bound().round() + # keep aspect ratio + scale = min(size.width() / src_size.width, size.height() / src_size.height) + m = fitz.Matrix(scale, scale) + page.getPixmap(m, alpha=False).writeImage(str(temp_dir_path / 'mainslide{:03d}.png'.format(i))) + pdf.close() created_files = sorted(temp_dir_path.glob('*')) for image_path in created_files: if image_path.is_file(): === modified file 'scripts/appveyor.yml' --- scripts/appveyor.yml 2019-04-02 00:05:46 +0000 +++ scripts/appveyor.yml 2019-05-01 09:29:24 +0000 @@ -16,11 +16,7 @@ install: # Install dependencies from pypi - - "%PYTHON%\\python.exe -m pip install sqlalchemy alembic appdirs chardet beautifulsoup4 lxml Mako mysql-connector-python pytest mock pyodbc psycopg2 pypiwin32 websockets asyncio waitress six webob requests QtAwesome PyQt5 PyQtWebEngine pymediainfo" - # Download and unpack mupdf - - appveyor DownloadFile https://mupdf.com/downloads/archive/mupdf-1.14.0-windows.zip - - 7z x mupdf-1.14.0-windows.zip - - cp mupdf-1.14.0-windows/mutool.exe openlp-branch/mutool.exe + - "%PYTHON%\\python.exe -m pip install sqlalchemy alembic appdirs chardet beautifulsoup4 lxml Mako mysql-connector-python pytest mock pyodbc psycopg2 pypiwin32 websockets asyncio waitress six webob requests QtAwesome PyQt5 PyQtWebEngine pymediainfo PyMuPDF" build: off === modified file 'setup.py' --- setup.py 2019-04-13 13:00:22 +0000 +++ setup.py 2019-05-01 09:29:24 +0000 @@ -187,6 +187,7 @@ 'websockets' ], extras_require={ + 'agpl-pdf': ['PyMuPDF'], 'darkstyle': ['QDarkStyle'], 'mysql': ['mysql-connector-python'], 'odbc': ['pyodbc'],
_______________________________________________ Mailing list: https://launchpad.net/~openlp-core Post to : openlp-core@lists.launchpad.net Unsubscribe : https://launchpad.net/~openlp-core More help : https://help.launchpad.net/ListHelp