Coder Social home page Coder Social logo

python-poppler-qt5's Introduction

README for Frescobaldi

Note about maintenance

Frescobaldi is unfortunately close to being unmaintained at present. Releases are extremely difficult to do due to deep packaging issues especially on macOS (issues with the macOS label) and Frescobaldi is still using PyQt5, which is now obsolete (#1407). Help to resolve these issues and continue the development of Frescobaldi is very welcome.

About Frescobaldi

Homepage: http://www.frescobaldi.org/ Main author: Wilbert Berendsen

Frescobaldi is a LilyPond sheet music text editor. It aims to be powerful, yet lightweight and easy to use. Frescobaldi is Free Software, freely available under the General Public License.

Features:

  • Powerful text editor with syntax highlighting and automatic completion
  • Music view with advanced two-way Point & Click
  • Midi player to proof-listen LilyPond-generated MIDI files
  • Midi capturing to enter music
  • Powerful Score Wizard to quickly setup a music score
  • Snippet Manager to store and apply text snippets, templates or scripts
  • Use multiple versions of LilyPond, automatically selects the correct version
  • Built-in LilyPond documentation browser and built-in help
  • Configurable document outline view to navigate large LilyPond scores easily
  • Smart layout-control functions like coloring specific objects in the PDF
  • Import ABC, Midi and MusicXML using the LilyPond-provided tools
  • Experimental export to MusicXML
  • Modern user interface with configurable colors, fonts and keyboard shortcuts
  • Translated into: Dutch, English, French, German, Italian, Swedish, Czech, Russian, Spanish, Galician, Turkish, Polish, Brazilian, Ukrainian, Traditional Chinese, Simplified Chinese and Japanese.

Music functions:

  • Transpose music
  • Change music from relative to absolute and vice versa
  • Change the language used for note names
  • Change the rhythm (double, halve, add/remove dots, copy, paste) etc
  • Hyphenate lyrics using word-processor hyphenation dictionaries
  • Add spanners, dynamics, articulation easily using the Quick Insert panel
  • Update LilyPond syntax using convert-ly, with display of differences

Frescobaldi is designed to run on all major operating systems (Linux, macOS and Windows). It is named after Girolamo Frescobaldi (1583-1643), an Italian composer of keyboard music in the late Renaissance and early Baroque period.

Here is an idea of the basic Frescobaldi workflow:

  • Start Frescobaldi
  • Open a .ly file or create one using File->New from template or Tools->Setup new Score... and fill in some music
  • Press Ctrl+M to run LilyPond
  • If the LilyPond output shows errors, press Ctrl+E to jump to the first error
  • If you see other mistakes in the music, click the notes to move the text cursor there
  • Fix the errors or mistakes in the text
  • Press Ctrl+M again to update the music view
  • When a piece is finished, press Ctrl+Shift+P once to run LilyPond with point and click turned off (this results in a much smaller PDF file).

Frescobaldi is written in Python and uses PyQt for its user interface.

Installation instructions for the program and MIDI support as well as other information can be found in the Wiki. Other requirements and installation instructions may also be found in the INSTALL.md file.

python-poppler-qt5's People

Contributors

alex-ball avatar anthonyfok avatar bnavigator avatar dliessi avatar edwardbetts avatar jeanas avatar kenjioman avatar mitya57 avatar mrtnnbr avatar wbsoft avatar woodlandhunter avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

python-poppler-qt5's Issues

Cannot build python-poppler-qt5: error "sip: QDomElement is undefined"

Trying to build a (rpm) package of python-poppler-qt5 for the still upcoming Rosa Linux Fresh 2016.1 (a Mandriva derivative, sibiling of Mageia and OpenMandriva) on x86_64.

The build process fails after the "python3 setup.py build build_ext --qmake-bin=/usr/bin/qmake-qt5" command with this error message (full log attached):


sip: QDomElement is undefined
error: command '/usr/bin/sip3' failed with exit status 1


The distro rules allow for a side-to-side installation of python 2.x and python 3.x: the packages related to the first one have names "python-xxx-yyy", while the packages related to the latter one have names "python3-xxx-yyy".
The same is true for Qt4 and Qt5 stuff: I already had to add the above "build_ext --qmake-bin=/usr/bin/qmake-qt5" to the build command line, otherwise the build would fail with the error "Unsupported Qt version", because it finds the old Qt4 and not the newer (installed) Qt5.
So I have on my disk both PyQt4 and PyQt5, for both python versions: python-qt4 (ver 4.12) - python-qt5 (ver. 5.8.1); and python3-qt4 (ver 4.12) - python3-qt5 (ver. 5.8.1). The packages also differs on what they are exporting to other python packages: eg. the python-qt5 one exports PyQt5, while the python3-qt5 exports Py3Qt5...

I don't know much about python, but I would guess that setup.py need to know about this trick with the module names...
BuildFailed.txt

qmake version

Shouldn't this code use qt5 qmake, not qt4 qmake?

Document.load fails with any argument

I had some code using this library that previously worked, but now something has changed, not in this library but affecting it. I don't know what.

Now when I use Document.load("path.pdf") I get:

TypeError: Document.load(): argument 1 has unexpected type 'str'

How to install on Windows 10?

Hi, I have been trying to install this for the past few days and have been going crazy. Here is my progress so far.

Environment

Qt Installation

Qt was installed using chocolatey
choco install qt5-default

SIP Installation

sip was installed by compiling sip-4.19.25.zip from the RiverBank site.

cd sip-4.19.25
python configure.py
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64
nmake
nmake install

pkg-config Installation

pkg-config was installed using chocolatey
choco install pkgconfiglite

Current package versions

qmake --version
QMake version 3.1
Using Qt version 5.15.2 in C:/Qt/5.15.2/mingw81_64/lib

sip -V
4.19.25

pkg-config --version
0.28

sip-build -V
6.6.1

python -V
Python 3.10.2

Python libraries

Here are the installed python libraries (of course I am not listing all of them, just the relevant ones)

pip==22.1.2
PyQt-builder==1.13.0
PyQt5==5.15.6
PyQt5-Qt5==5.15.2
PyQt5-sip==12.10.1
setuptools==62.4.0
sip==6.6.1
wheel==0.37.1

Qt5 Poppler

The Qt5 poppler binaries for windows were downloaded from SourceForge poppler-qt5 for mingw32 and extracting the content to C:/ and creating a new file in C:/poppler called poppler-qt5.pc with the following contents. C:/poppler was then added to my environment PKG_CONFIG_PATH variable.

prefix=C:/poppler
libdir=C:/poppler/lib
includedir=C:/poppler/include

Name: poppler-qt5
Description: PDF rendering library
Version: 0.32.0

Libs: -L${libdir} -llibpoppler-qt5
Cflags: -I${includedir}/poppler/qt5 -I${includedir}/poppler

Errors

I cloned the repo to my computer using git and opened a terminal in that directory.

sip-build

sip-build --verbose
Querying qmake about your Qt installation...
C:\Qt\5.15.2\mingw81_64\bin\qmake.exe -query
sip-build: '12.11' is not a supported ABI version

pip install .

pip install .
Processing c:\python-poppler-qt5
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [5478 lines of output]
      Querying qmake about your Qt installation...
      These bindings will be built: Poppler-Qt5.
      Generating the Poppler-Qt5 bindings...
      Generating the .pro file for the popplerqt5 module...
      Generating the top-level .pro file...
      Generating the Makefiles...
      Compiling the project...
      _in_process.py: 'make' could not be found on PATH
      Traceback (most recent call last):
        File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\shutil.py", line 619, in _rmtree_unsafe
          os.rmdir(path)
      PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\User\\AppData\\Local\\Temp\\tmp9l8gih7s'

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\tempfile.py", line 820, in onerror
          _os.unlink(path)
      PermissionError: [WinError 5] Access is denied: 'C:\\Users\\User\\AppData\\Local\\Temp\\tmp9l8gih7s'

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\shutil.py", line 619, in _rmtree_unsafe
          os.rmdir(path)
      PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\User\\AppData\\Local\\Temp\\tmp9l8gih7s'

      During handling of the above exception, another exception occurred:

...
...
repeats for a while
...
...

During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\shutil.py", line 619, in _rmtree_unsafe
          os.rmdir(path)
      PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\User\\AppData\\Local\\Temp\\tmp9l8gih7s'

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\tempfile.py", line 820, in onerror
          _os.unlink(path)
      PermissionError: [WinError 5] Access is denied: 'C:\\Users\\User\\AppData\\Local\\Temp\\tmp9l8gih7s'

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\weakref.py", line 667, in _exitfunc
          f()
        File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\weakref.py", line 591, in __call__
          return info.func(*info.args, **(info.kwargs or {}))
        File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\tempfile.py", line 836, in _cleanup
          cls._rmtree(name, ignore_errors=ignore_errors)
        File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\tempfile.py", line 832, in _rmtree
          _shutil.rmtree(name, onerror=onerror)
        File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\shutil.py", line 739, in rmtree
          return _rmtree_unsafe(path, onerror)
        File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\shutil.py", line 621, in _rmtree_unsafe
          onerror(os.rmdir, path, sys.exc_info())
        File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\tempfile.py", line 823, in onerror
          cls._rmtree(path, ignore_errors=ignore_errors)
        File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\tempfile.py", line 832, in _rmtree
          _shutil.rmtree(name, onerror=onerror)
        File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\shutil.py", line 739, in rmtree
          return _rmtree_unsafe(path, onerror)
        File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\shutil.py", line 621, in _rmtree_unsafe

...
...
repeats for a while
...
...

File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\tempfile.py", line 823, in onerror
          cls._rmtree(path, ignore_errors=ignore_errors)
        File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\tempfile.py", line 832, in _rmtree
          _shutil.rmtree(name, onerror=onerror)
        File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\shutil.py", line 739, in rmtree
          return _rmtree_unsafe(path, onerror)
        File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\shutil.py", line 619, in _rmtree_unsafe
          os.rmdir(path)
      RecursionError: maximum recursion depth exceeded while calling a Python object
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

setup.py build/build_ext

I tried hard with this method, but I deleted all my progress after losing hope. Basically the issue was the program not being able to find a bunch of files such as QtCore/QtCoremod.sip etc, and source files which I downloaded from the net. I do not want to do this all again unless I have to. The current output is as follows.

setup.py build
C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\dist.py:772: UserWarning: Usage of dash-separated 'force-manifest' will not be supported in future versions. Please use the underscore name 'force_manifest' instead
  warnings.warn(
running build
running build_ext
building 'popplerqt5' extension
C:\Users\User\AppData\Local\Programs\Python\Python310\sip.exe -I C:\Users\User\AppData\Local\Programs\Python\Python310\sip -t POPPLER_V0_31_0 -c build\temp.win-amd64-cpython-310\Release -b build\temp.win-amd64-cpython-310\Release\poppler-qt5.sbf -I C:\Users\User\AppData\Local\Programs\Python\Python310\sip\PyQt5 -n PyQt5.sip -t Qt_5_15_0 -t WS_WIN poppler-qt5.sip
sip: Unable to find file "QtCore/QtCoremod.sip"
error: command 'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python310\\sip.exe' failed with exit code 1

python 3.10: pip install fails

I tried installing from pypi and failed, then I tried directly from the repository:

$ pip install git+https://github.com/frescobaldi/python-poppler-qt5.git
Collecting git+https://github.com/frescobaldi/python-poppler-qt5.git
  Cloning https://github.com/frescobaldi/python-poppler-qt5.git to ./pip-req-build-rdc44o7z
  Running command git clone --filter=blob:none --quiet https://github.com/frescobaldi/python-poppler-qt5.git /tmp/pip-req-build-rdc44o7z
  Resolved https://github.com/frescobaldi/python-poppler-qt5.git to commit b9b95ae34b7892ec702fa67d1ff2e8c68ccd076a
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [38 lines of output]
      Querying qmake about your Qt installation...
      Package poppler-qt5 was not found in the pkg-config search path.
      Perhaps you should add the directory containing `poppler-qt5.pc'
      to the PKG_CONFIG_PATH environment variable
      No package 'poppler-qt5' found
      Traceback (most recent call last):
        File "/tmp/tt/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 156, in prepare_metadata_for_build_wheel
          hook = backend.prepare_metadata_for_build_wheel
      AttributeError: module 'sipbuild.api' has no attribute 'prepare_metadata_for_build_wheel'
      
      During handling of the above exception, another exception occurred:
      
      Traceback (most recent call last):
        File "/tmp/tt/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
          main()
        File "/tmp/tt/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/tmp/tt/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 160, in prepare_metadata_for_build_wheel
          whl_basename = backend.build_wheel(metadata_directory, config_settings)
        File "/tmp/pip-build-env-2__u30zh/overlay/lib/python3.10/site-packages/sipbuild/api.py", line 46, in build_wheel
          project = AbstractProject.bootstrap('wheel',
        File "/tmp/pip-build-env-2__u30zh/overlay/lib/python3.10/site-packages/sipbuild/abstract_project.py", line 87, in bootstrap
          project.setup(pyproject, tool, tool_description)
        File "/tmp/pip-build-env-2__u30zh/overlay/lib/python3.10/site-packages/sipbuild/project.py", line 585, in setup
          self.apply_user_defaults(tool)
        File "/tmp/pip-build-env-2__u30zh/overlay/lib/python3.10/site-packages/pyqtbuild/project.py", line 70, in apply_user_defaults
          super().apply_user_defaults(tool)
        File "/tmp/pip-build-env-2__u30zh/overlay/lib/python3.10/site-packages/sipbuild/project.py", line 239, in apply_user_defaults
          bindings.apply_user_defaults(tool)
        File "/tmp/pip-req-build-rdc44o7z/project.py", line 50, in apply_user_defaults
          cflags = self.run_pkg_config('--cflags-only-I').split()
        File "/tmp/pip-req-build-rdc44o7z/project.py", line 43, in run_pkg_config
          output = subprocess.check_output(
        File "/usr/lib/python3.10/subprocess.py", line 420, in check_output
          return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
        File "/usr/lib/python3.10/subprocess.py", line 524, in run
          raise CalledProcessError(retcode, process.args,
      subprocess.CalledProcessError: Command '['pkg-config', '--cflags-only-I', 'poppler-qt5']' returned non-zero exit status 1.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
$ pip --version
pip 22.2.2 from /tmp/tt/lib/python3.10/site-packages/pip (python 3.10)

Building on Mac with latest SIP fails

OS X El Capitan 10.11.6, dependencies provided via MacPorts, latest available versions (Python 3.6.5, Qt/PyQt 5.10.1, Poppler 0.65.0).

Building python-poppler-qt5 succeeds using SIP 4.19.8 but fails using SIP 4.19.10 with the following log:

Executing:  cd "/opt/local/var/macports/build/_opt_macports-git_macports-ports_python_py-poppler-qt5/py36-poppler-qt5/work/python-poppler-qt5-0.24.2" && /opt/local/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 setup.py --no-user-cfg build 
DEBUG: system:  cd "/opt/local/var/macports/build/_opt_macports-git_macports-ports_python_py-poppler-qt5/py36-poppler-qt5/work/python-poppler-qt5-0.24.2" && /opt/local/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 setup.py --no-user-cfg build 
running build
running build_ext
building 'popplerqt5' extension
/opt/local/bin/sip-3.6 -I /opt/local/share/py36-sip -t POPPLER_V0_28_0 -c build/temp.macosx-10.11-x86_64-3.6 -b build/temp.macosx-10.11-x86_64-3.6/poppler-qt5.sbf -I /opt/local/Library/Frameworks/Python.framework/Versions/3.6/share/sip/PyQt5/ -t WS_MACX -t Qt_5_10_1 poppler-qt5.sip
sip: Deprecation warning: poppler-qt5.sip:1: %Module version numbers are deprecated and ignored
error: command '/opt/local/bin/sip-3.6' terminated by signal 11
Command failed:  cd "/opt/local/var/macports/build/_opt_macports-git_macports-ports_python_py-poppler-qt5/py36-poppler-qt5/work/python-poppler-qt5-0.24.2" && /opt/local/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 setup.py --no-user-cfg build 
Exit code: 1

Any ideas on how to solve or at least try to diagnose this problem?

the sip version problem

I can not import the popplerqt5 , and use the python3.4 compile it , the sip use the version 4.16.6 . what should i do ?

>>> import popplerqt5
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
RuntimeError: the sip module implements API v11.0 but the popplerqt5 module requires API v11.1

Support manually specify sip path

Under windows, MinGW python may have path problems. For example, it might try to execute a command "/mingw32/bin/cmd" in windows way, which may cause "Command not found" problem.

ImportError: No module named 'sipdistutils'

On Ubuntu 16.04LTS in a virtualenv, building python-poppler-qt5 fails:

$ cd python-poppler-qt5
$ python3.5 setup.py build
Traceback (most recent call last):
  File "setup.py", line 42, in <module>
    import sipdistutils
ImportError: No module named 'sipdistutils'

But sip is installed:

$ pip3 freeze | grep sip
sip==4.19.1

What am I missing?

[Feature request] PySide2 / PySide6 support?

Since PySide is officially supported by The Qt Company and since it is provided under a more liberal license, I chose to prefer it over PyQt for my application. Would it be possible for python-poppler-qt5 to support both Qt bindings through a wrapper like Qt5.py?

textColor and setTextColor members of TextAnnotation subclass not accessible

I'm finding this project to be highly valuable. Thanks for making it available.

One thing I've run into is that I can only change the background color of pdf text annotations, not the color of the text itself. The former seems to be possible within poppler-qt5, but isn't wrapped here?

https://people.freedesktop.org/~aacid/docs/qt5/classPoppler_1_1TextAnnotation.html

SetTextFont is wrapped, but the QFont class passed into that doesn't include the text color. If textColor and setTextColor could be accessible via this Python interface then that would be great.

ModuleNotFoundError: No module named 'sipdistutils'

Description

When installing python-poppler-qt5 using pip3 install python-poppler-qt5 I get this error stated in the title of this issue. However, when installing the module by using pip3 install git+https://github.com/frescobaldi/python-poppler-qt5.git, it installs perfectly fine. pypi and the one installed using the git method both show a version of 21.1.0

Errored Install:

Collecting python-poppler-qt5
  Downloading python-poppler-qt5-21.1.0.tar.gz (28 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... error
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python /home/vagrant/.local/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpunwefy62
         cwd: /tmp/pip-install-7yk12_tt/python-poppler-qt5_14f13cf3ca1d41d1b369c66a4e4f7f14
    Complete output (6 lines):
    Querying qmake about your Qt installation...
    /usr/bin/qmake -query
    These bindings will be built: Poppler-Qt5.
    Generating the Poppler-Qt5 bindings...
    _in_process.py: poppler-form.sip:152: ::Poppler::FormFieldChoice::choicesWithExportValues() unsupported function return type - provide %MethodCode and a C++ signature
    
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/70/13/264e20336f7951044a8dd49cb1460bd318e2ebacff1753f908e6544ec933/python-poppler-qt5-21.1.0.tar.gz#sha256=add766db2c04026a6087f38f2044e66c8b053c81002f3753d8059713497d022d (from https://pypi.org/simple/python-poppler-qt5/). Command errored out with exit status 1: /usr/bin/python /home/vagrant/.local/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpunwefy62 Check the logs for full command output.
  Downloading python-poppler-qt5-0.75.0.tar.gz (23 kB)
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-7yk12_tt/python-poppler-qt5_bac1ce8621904755b3abc8b90dacc52c/setup.py'"'"'; __file__='"'"'/tmp/pip-install-7yk12_tt/python-poppler-qt5_bac1ce8621904755b3abc8b90dacc52c/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-6f_18u1d
         cwd: /tmp/pip-install-7yk12_tt/python-poppler-qt5_bac1ce8621904755b3abc8b90dacc52c/
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-7yk12_tt/python-poppler-qt5_bac1ce8621904755b3abc8b90dacc52c/setup.py", line 42, in <module>
        import sipdistutils
    ModuleNotFoundError: No module named 'sipdistutils'

Successful install:

[vagrant@pyqt src]$ pip3 install git+https://github.com/frescobaldi/python-poppler-qt5.git
Defaulting to user installation because normal site-packages is not writeable
Collecting git+https://github.com/frescobaldi/python-poppler-qt5.git
  Cloning https://github.com/frescobaldi/python-poppler-qt5.git to /tmp/pip-req-build-py53ysr3
  Running command git clone -q https://github.com/frescobaldi/python-poppler-qt5.git /tmp/pip-req-build-py53ysr3
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Requirement already satisfied: PyQt5 in /home/vagrant/.local/lib/python3.9/site-packages (from python-poppler-qt5==21.1.0) (5.15.4)
Requirement already satisfied: PyQt5-sip<13,>=12.8 in /home/vagrant/.local/lib/python3.9/site-packages (from python-poppler-qt5==21.1.0) (12.9.0)
Requirement already satisfied: PyQt5-Qt5>=5.15 in /home/vagrant/.local/lib/python3.9/site-packages (from PyQt5->python-poppler-qt5==21.1.0) (5.15.2)
Building wheels for collected packages: python-poppler-qt5
  Building wheel for python-poppler-qt5 (PEP 517) ... done
  Created wheel for python-poppler-qt5: filename=python_poppler_qt5-21.1.0-cp39-cp39-manylinux2014_x86_64.whl size=182653 sha256=91304c5dfc47d52a32a6c884af2198a8b51ca553eece088ae81e85aa36cf70d0
  Stored in directory: /tmp/pip-ephem-wheel-cache-lfq8oqqq/wheels/6d/e8/ce/92e5b898251529122baa575b2bd6be160a05f66fd8d4e3f81a
Successfully built python-poppler-qt5
Installing collected packages: python-poppler-qt5
Successfully installed python-poppler-qt5-21.1.0

sip: Poppler::LinkRendition is undefined

I saw that there is a closed issue regarding this, but I am getting the following error when trying to install python-poppler-qt5 with pip (also when trying to compile it from the source files):

/usr/local/Cellar/sip/4.19.23/bin/sip -I /usr/local/share/sip -t POPPLER_V0_20_0 -c build/temp.macosx-10.15-x86_64-3.8 -b build/temp.macosx-10.15-x86_64-3.8/poppler-qt5.sbf -I /usr/local/share/sip/PyQt5 -n PyQt5.sip -t Qt_5_15_0 -t WS_MACX poppler-qt5.sip

sip: Poppler::LinkRendition is undefined

error: command '/usr/local/Cellar/sip/4.19.23/bin/sip' failed with exit status 1

It could be related to the previous issue but I am not sure. Any ideas about what could be wrong with my environment? I am doing this with MacOS. Pip version:

pip 20.1.1 from /usr/local/lib/python3.8/site-packages/pip (python 3.8)

"Can't determine version of poppler-qt5" on Arch

I'm trying to install this (for Frescobaldi), but it won't build.

$ pacaur -S python-poppler-qt5
:: Package python-poppler-qt5 not found in repositories, trying AUR...
:: resolving dependencies...
:: looking for inter-conflicts...

AUR Packages  (1) python-poppler-qt5-0.24.2-2  

:: Proceed with installation? [Y/n] 
:: Retrieving package(s)...
:: python-poppler-qt5 build files are up-to-date -- skipping
:: Checking python-poppler-qt5 integrity...
==> Making package: python-poppler-qt5 0.24.2-2 (Fri Jun  8 13:43:56 CEST 2018)
==> Retrieving sources...
  -> Found v0.24.2.tar.gz
  -> Found python-poppler-qt5-0.24.2.patch
==> Validating source files with sha256sums...
    v0.24.2.tar.gz ... Passed
    python-poppler-qt5-0.24.2.patch ... Passed
:: Preparing python-poppler-qt5...
==> Making package: python-poppler-qt5 0.24.2-2 (Fri Jun  8 13:43:57 CEST 2018)
==> WARNING: Skipping dependency checks.
==> Retrieving sources...
  -> Found v0.24.2.tar.gz
  -> Found python-poppler-qt5-0.24.2.patch
==> WARNING: Skipping all source file integrity checks.
==> Extracting sources...
  -> Extracting v0.24.2.tar.gz with bsdtar
==> Starting prepare()...
patching file poppler-qt5.sip
patching file types.sip
==> Sources are ready.
:: Building python-poppler-qt5 package(s)...
==> Making package: python-poppler-qt5 0.24.2-2 (Fri Jun  8 13:43:57 CEST 2018)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> WARNING: Using existing $srcdir/ tree
==> Removing existing $pkgdir/ directory...
==> Entering fakeroot environment...
==> Starting package()...
running install
running build
running build_ext
building 'popplerqt5' extension
Can't determine version of poppler-qt5
/usr/bin/sip -I /usr/share/sip -t POPPLER_V0_20_0 -c build/temp.linux-x86_64-3.6 -b build/temp.linux-x86_64-3.6/poppler-qt5.sbf -I /usr/share/sip/PyQt5 -t WS_X11 -t Qt_5_10_1 poppler-qt5.sip
sip: Deprecation warning: poppler-qt5.sip:1: %Module version numbers are deprecated and ignored
sip: Poppler::LinkRendition is undefined
error: command '/usr/bin/sip' failed with exit status 1
==> ERROR: A failure occurred in package().
    Aborting...
:: failed to build python-poppler-qt5 package(s)

I think this is the same issue as #24, but a little more detailed.

Install hangs on build

Running Arch 4.14.5, pacman install hangs on a loop of the last two lines of the install log below:

running install
running build
running build_ext
building 'popplerqt5' extension
/usr/bin/sip -I /usr/share/sip -t POPPLER_V0_28_0 -c build/temp.linux-x86_64-3.6 -b build/temp.linux-x86_64-3.6/poppler-qt5.sbf -I /usr/share/sip/PyQt5 -t WS_X11 -t Qt_5_10_0 poppler-qt5.sip
sip: Deprecation warning: poppler-qt5.sip:1: %Module version numbers are deprecated and ignored
creating build/temp.linux-x86_64-3.6/build
creating build/temp.linux-x86_64-3.6/build/temp.linux-x86_64-3.6
gcc -pthread -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/poppler/qt5 -I/usr/include/poppler -I/usr/include/python3.6m -I/usr/include/python3.6m -I/usr/include/qt -I/usr/include/qt/QtCore -I/usr/include/qt/QtGui -I/usr/include/qt/QtXml -c build/temp.linux-x86_64-3.6/sippopplerqt5cmodule.cpp -o build/temp.linux-x86_64-3.6/build/temp.linux-x86_64-3.6/sippopplerqt5cmodule.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++

Can't install, error with Sip

I think I've installed all the pre-requisites, but I'm getting an error with sip (i guess)

$ python3 setup.py build
running build
running build_ext
building 'popplerqt5' extension

/usr/bin/sip -I /usr/share/sip -t POPPLER_V0_28_0 -c build/temp.linux-x86_64-3.6 -b build/temp.linux-x86_64-3.6/poppler-qt5.sbf -I /usr/share/sip/PyQt5 -n PyQt5.sip -t WS_X11 -t Qt_5_11_2 poppler-qt5.sip

sip: Usage: sip [-h] [-V] [-a file] [-b file] [-B tag] [-c dir] [-d file] [-D] [-e] [-f] [-g] [-I dir] [-j #] [-k] [-m file] [-o] [-p module] [-P] [-r] [-s suffix] [-t tag] [-w] [-x feature] [-X id:file] [-y file] [-z file] [@file] [file]

error: command '/usr/bin/sip' failed with exit status 1

From what I could track, the problem relay in the '-n' flag (but I have no idea if my guess is correct)

Anyway, here are some infos from my system:

OS:

running on Windows Subsystem for Linux
$ lsb_release -a
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description:    Ubuntu 18.04.1 LTS
    Release:        18.04
    Codename:       bionic

SIP version:

$ sip -V
    4.19.7

poppler-qt5 [idk if this is installed correctly]:

$ dpkg -l | grep libpoppler-qt5-dev
    ii  libpoppler-qt5-dev:amd64                   0.62.0-2ubuntu2.5
                  amd64        PDF rendering library -- development files (Qt 5 interface)
$ dpkg -l | grep libpoppler-qt5-1
    ii  libpoppler-qt5-1:amd64                     0.62.0-2ubuntu2.5
                  amd64        PDF rendering library (Qt 5 based shared library)
$ dpkg -l | grep python3-poppler-qt5
    ii  python3-poppler-qt5                        0.24.2-3build3
                  amd64        Python binding to Poppler-Qt5 C++ library
(Python 3) 

QT5 and PyQt5:

>>> import inspect
>>> from PyQt5 import Qt
>>> vers = ['%s = %s' % (k,v) for k,v in vars(Qt).items() if k.lower().find('version') >= 0 and not inspect.isbuiltin(v)]
>>> print('\n'.join(sorted(vers)))PYQT_VERSION = 330499
    PYQT_VERSION_STR = 5.11.3
    QOpenGLVersionProfile = <class 'PyQt5.QtGui.QOpenGLVersionProfile'>
    QOperatingSystemVersion = <class 'PyQt5.QtCore.QOperatingSystemVersion'>
    QT_VERSION = 330498
    QT_VERSION_STR = 5.11.2
    QVersionNumber = <class 'PyQt5.QtCore.QVersionNumber'>

Another thing I've noticed is that I can't run simply 'python setup.py build' (instead of 'python3 ...'), because there is no PyQt5 package for python2 (at least I didn't found)

Let me know if there's any other relevant info i should've provided.

Build problem

$ python3 setup.py build
running build
running build_ext
building 'popplerqt5' extension
/usr/bin/sip -I /usr/share/sip -t POPPLER_V0_28_0 -c build/temp.linux-x86_64-3.5 -b build/temp.linux-x86_64-3.5/poppler-qt5.sbf -I /usr/share/sip/PyQt5 -t WS_X11 -t Qt_5_6_1 poppler-qt5.sip
sip: Unable to find file "QtCore/QtCoremod.sip"
error: command '/usr/bin/sip' failed with exit status 1

Obviously the tool adds /usr/share/sip/PyQt5 to the include path - but I don't have any PyQt there, not even an /usr/share/sip. Actually I don't find any entry for PyQt5 and sip (using Ubuntu 16.10).

Looking through setup.py I must admit I don't really see how that value for the command line is retrieved.

Frescobaldi: 3.0.0
Python: 3.5.2+
python-ly: 0.9.5
Qt: 5.6.1
PyQt: 5.7
sip: 4.18.1
poppler: 0.38.0
python-poppler-qt: 0.24.2
OS: Linux-4.8.0-46-generic-x86_64-with-Ubuntu-16.10-yakkety

Not compilable

Hello Guys,

i even don't know what i'm doing wrong, but i have the same issue on two different systems (Debian as well as Gentoo):

Installing collected packages: python-poppler-qt5
  Running setup.py install for python-poppler-qt5
    building 'popplerqt5' extension
    /usr/bin/sip -I /usr/share/sip -t POPPLER_V0_20_0 -c build/temp.linux-x86_64-3.4 -b build/temp.linux-x86_64-3.4/poppler-qt5.sbf -I /usr/share/sip/PyQt5 -t WS_X11 -t Qt_5_4_1 poppler-qt5.sip
    sip: QDomElement is undefined
    Can't determine version of poppler-qt5
    error: command '/usr/bin/sip' failed with exit status 1
    Complete output from command /usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip-build-h3ed8rd_/python-poppler-qt5/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-qufom6di-record/install-record.txt --single-version-externally-managed --compile:
    running install

    running build

    running build_ext

    building 'popplerqt5' extension

    /usr/bin/sip -I /usr/share/sip -t POPPLER_V0_20_0 -c build/temp.linux-x86_64-3.4 -b build/temp.linux-x86_64-3.4/poppler-qt5.sbf -I /usr/share/sip/PyQt5 -t WS_X11 -t Qt_5_4_1 poppler-qt5.sip

    sip: QDomElement is undefined

    Can't determine version of poppler-qt5

    error: command '/usr/bin/sip' failed with exit status 1

    ----------------------------------------
    Command "/usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip-build-h3ed8rd_/python-poppler-qt5/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-qufom6di-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-h3ed8rd_/python-poppler-qt5

I have installed Qt 5.4.1 and also PyQt 5.4.1. For SIP i've installed version 4.16.7.

Did i missed something? How can i resolve that issue? If i'm removing the QDomElement parts (because i even don't need the annotation feature), he misses the QDomDocument and so on. But i can import these elements without any problems.

Especially on gentoo i can ensure that the qtxml part is also installed. To get it compiled i now said the setup.py that i don't have qtxml installed. But it is not really beautiful.

Thanks and Regards,
Lukas

Installation headaches on Mac and Windows

Hi. I like this package for the functionality it provides, thanks for your work.

TLDR: After some fiddling I was able to use the package and it provides exactly what my app needs.
However installing it required some hacks and I don't know how to reliably install the package on other systems.
Moreover I was unable to use pyinstaller to bundle the app.


I am developing a PyQt5 app that needs to render PDF pages.
This package provides just what I needed.
My first issue with it was installing it on my system (MacOs 10.15, Python 3.8.2, Qt 5.15.2).
What I did after some trial&error was:

brew install cmake poppler-qt5
pip install git+git://github.com/frescobaldi/python-poppler-qt5@92e5962ec3751ab051d0b655fd61afc7a1cf709e

For reasons that are not clear to me to make that work I had to manually link the directory of PyQt5-stubs so that it could be found by python-poppler-qt5.

After that I can run my app and it works perfectly.
I would not know where to start, however, in giving instructions to reliably replicate the installation on other machines.
In the trial and error phase I also managed to get all the error messages mentioned in building/installation issues on this repo, suggesting those are still not addressed.

To make this worse, even after installing the library on my system, I cannot successfully bundle the app with pyinstaller. That is, I can produce a bundle but it will crash when the features using python-poppler-qt5 are exercised. I am not familiar enough with the internals of pyinstaller to really figure out what goes wrong, but maybe it has trouble bundling poppler?

Finally, I tried to install python-poppler-qt5 on Windows, but I am clueless about how to install the dependencies (e.g. poppler) so that the installation through pip works.

I guess #42 would help with this?

I am at this point stumped and would appreciate some advice for how to approach the problem.

Possibly incorrect default value for `pyqt_sip_dir`

(Environment instructions at the end of this post)

When performing setup.py build_ext without any additional options, the script uses this code to determine pyqt_sip_dir:

python-poppler-qt5/setup.py

Lines 205 to 211 in 22e0f8b

def __find_pyqt_sip_dir(self):
if self.pyqtconfig:
return self.pyqtconfig.pyqt_sip_dir
import sipconfig
return os.path.join(sipconfig.Configuration().default_sip_dir, 'PyQt5')

For my version of PyQt5 == 5.14.1, the if self.pyqtconfig check failed, so the code got the directory from sipconfig. Thus, the value of the directory was set to:

pyqt_sip_dir = "/path/to/virtualenv/share/sip/PyQt5"

which caused an error in the build process:

sip: Unable to find file "QtCore/QtCoremod.sip" 

I figured this was because pyqt_sip_dir was possibly incorrect; manually checking that path revealed there was no such folder! Instead, I had to supply manually a path, with the cmdline argument:

--pyqt-sip-dir==/path/to/virtualenv/lib/python3.7/site-packages/PyQt5/bindings

, and this was the only change needed for setup.py build to successfully build the library.

I wonder if this is an issue with the install for sip itself, installation of PyQt5, or if the way pyqt_sip_dir is set;
Is it possible to change the default from the sipconfig way to this /lib/python/... way?


My Environment:

Using pipenv:

  • python==3.7.6
  • sip==4.19.20 (Installed manually, not through pipenv, as per #29 (comment))
  • pyqt5==5.14.1
  • Poppler==0.84.0

Extract highlighted text

I am trying to extract highlighted text from a PDF (so text that is underneath a highlight annotation). When I pass the annotation boundary rectangle to page.text(), no text is returned. Am I missing something?

import popplerqt5

doc = popplerqt5.Poppler.Document.load('./test1.pdf')
page = doc.page(0)

for annot in page.annotations():
    if annot.contents():
        print(annot.contents())
        rect = annot.boundary()
        rect_txt = page.text(rect)
        if rect_txt == '':
            print('---')
        else:
            print(rect_txt)

Out:

highlight note 1
---
highlight note 2
---
note on page
---

test1.pdf

Undefined reference to '__imp__'

Hi, I've been trying to build python-poppler-qt5 in Cygwin, but have run into a slew of the above errors, then, at the end, it says "collect2: error: ld returned 1 exit status" and "error: command g++ failed with exit status 1". What do I do?

python setup.py build

my OS windows7
I have installed the follow software :
python3.5
pyqt5
Qt5.4.2 with mingw491_32
SIP
poppler( help to KED )

after download the python-poppler-qt5

I type down the command :python setup.py build

a message "Failed to determine Qt version "turn out.
pkg_config .exe is not installed in my computer.

Building 21.1.0 fails with unsupported function return type

When I try building python-poppler-qt5-21.1.0 with the following

python3.9 /usr/x86_64-pc-linux-gnu/bin/sip-build --build-dir /var/tmp/paludis/build/dev-python-python-poppler-qt5-21.1.0/work/PYTHON_ABIS/3.9 --no-make --qmake /usr/x86_64-pc-linux-gnu/lib/qt5/bin/qmake --target-dir /usr/x86_64-pc-linux-gnu/lib/python3.9/site-packages --verbose

it fails with

Querying qmake about your Qt installation...
/usr/x86_64-pc-linux-gnu/lib/qt5/bin/qmake -query
These bindings will be built: Poppler-Qt5.
Generating the Poppler-Qt5 bindings...

sip-build: poppler-form.sip:152: ::Poppler::FormFieldChoice::choicesWithExportValues() unsupported function return type - provide %MethodCode and a C++ signature

This is with sip-5.5.0, PyQt5-5.15.2 and poppler-21.01.0.

Failed to install on Python 3.11 on Windows 10

all other modules were up-to-date including pip

Collecting python-poppler-qt5
  Using cached python-poppler-qt5-21.3.0.tar.gz (28 kB)
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
  Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): finished with status 'error'

  error: subprocess-exited-with-error
  
  Preparing metadata (pyproject.toml) did not run successfully.
  exit code: 1
  
  [31 lines of output]
  Traceback (most recent call last):
    File "C:\Users\Lenovo\PycharmProjects\TPRT\venv\Lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 144, in prepare_metadata_for_build_wheel
      hook = backend.prepare_metadata_for_build_wheel
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  AttributeError: module 'sipbuild.api' has no attribute 'prepare_metadata_for_build_wheel'
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File "C:\Users\Lenovo\PycharmProjects\TPRT\venv\Lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 351, in <module>
      main()
    File "C:\Users\Lenovo\PycharmProjects\TPRT\venv\Lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 333, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\Lenovo\PycharmProjects\TPRT\venv\Lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 148, in prepare_metadata_for_build_wheel
      whl_basename = backend.build_wheel(metadata_directory, config_settings)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\Lenovo\AppData\Local\Temp\pip-build-env-0_z79xp0\overlay\Lib\site-packages\sipbuild\api.py", line 46, in build_wheel
      project = AbstractProject.bootstrap('wheel',
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\Lenovo\AppData\Local\Temp\pip-build-env-0_z79xp0\overlay\Lib\site-packages\sipbuild\abstract_project.py", line 87, in bootstrap
      project.setup(pyproject, tool, tool_description)
    File "C:\Users\Lenovo\AppData\Local\Temp\pip-build-env-0_z79xp0\overlay\Lib\site-packages\sipbuild\project.py", line 585, in setup
      self.apply_user_defaults(tool)
    File "C:\Users\Lenovo\AppData\Local\Temp\pip-build-env-0_z79xp0\overlay\Lib\site-packages\pyqtbuild\project.py", line 70, in apply_user_defaults
      super().apply_user_defaults(tool)
    File "C:\Users\Lenovo\AppData\Local\Temp\pip-build-env-0_z79xp0\overlay\Lib\site-packages\sipbuild\project.py", line 236, in apply_user_defaults
      self.builder.apply_user_defaults(tool)
    File "C:\Users\Lenovo\AppData\Local\Temp\pip-build-env-0_z79xp0\overlay\Lib\site-packages\pyqtbuild\builder.py", line 69, in apply_user_defaults
      raise PyProjectOptionException('qmake',
  sipbuild.pyproject.PyProjectOptionException
  [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

Encountered error while generating package metadata.

See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

rename python-poppler4.dll

This project still tries to generate "python-poppler4.dll". Maybe it should be renamed as "python-poppler5.dll" ?

sip-install and poppler-annotation.sip problems

I'm trying to update Frescobaldi flatpak and use the recently added PyQt baseapp, which provides some dependencies I used to install within the flatpak manifest I maintain.
As you can see in pull 6, the latest aarch64 build is failing with the following error:

Building module python-poppler-qt5 in /srv/buildbot/worker/build-aarch64-7/build/.flatpak-builder/build/python-poppler-qt5-1
========================================================================
�]2;flatpak-builder: Building python-poppler-qt5�FB: Running: cp -al /srv/buildbot/worker/build-aarch64-7/build/.flatpak-builder/git/https_github.com_frescobaldi_python-poppler-qt5_ /srv/buildbot/worker/build-aarch64-7/build/.flatpak-builder/build/python-poppler-qt5-1/.git
FB: Running: git config --bool core.bare false
FB: Running: git checkout master
Already on 'master'
FB: Running: git rev-parse --verify --quiet master:.gitmodules
�]2;flatpak-builder: Installing python-poppler-qt5�Running: sip-install --verbose --target-dir /app/lib/python3.9/site-packages
FB: Running 'flatpak build --die-with-parent --env=FLATPAK_BUILDER_BUILDDIR=/run/build/python-poppler-qt5 --nofilesystem=host:reset --filesystem=/srv/buildbot/worker/build-aarch64-7/build/.flatpak-builder/build/python-poppler-qt5-1 --bind-mount=/run/build/python-poppler-qt5=/srv/buildbot/worker/build-aarch64-7/build/.flatpak-builder/build/python-poppler-qt5-1 --build-dir=/run/build/python-poppler-qt5 --bind-mount=/run/ccache=/srv/buildbot/worker/build-aarch64-7/build/.flatpak-builder/ccache --unshare=network --env=SOURCE_DATE_EPOCH=1651439730 '--env=CFLAGS=-O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -fasynchronous-unwind-tables -fstack-clash-protection -fno-omit-frame-pointer ' '--env=CXXFLAGS=-O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -fasynchronous-unwind-tables -fstack-clash-protection -fno-omit-frame-pointer ' '--env=LDFLAGS=-L/app/lib -Wl,-z,relro,-z,now -Wl,--as-needed ' --env=CCACHE_DIR=/run/ccache/disabled --env=PATH=/app/bin:/usr/bin --env=LD_LIBRARY_PATH=/app/lib --env=PKG_CONFIG_PATH=/app/lib/pkgconfig:/app/share/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig --env=FLATPAK_BUILDER_N_JOBS=64 /srv/buildbot/worker/build-aarch64-7/build/.flatpak-builder/rofiles/rofiles-bap1B5 /bin/sh -c 'sip-install --verbose --target-dir /app/lib/python3.9/site-packages'' on host
Querying qmake about your Qt installation...
/usr/bin/qmake -query
These bindings will be built: Poppler-Qt5.
Generating the Poppler-Qt5 bindings...
sip-install: /run/build/python-poppler-qt5/poppler-annotation.sip: line 614 column 13: '%' is unexpected
/run/build/python-poppler-qt5/poppler-annotation.sip: line 617 column 21: '(' is unexpected
/run/build/python-poppler-qt5/poppler-annotation.sip: line 619 column 36: '=' is unexpected
/run/build/python-poppler-qt5/poppler-annotation.sip: line 632 column 39: '=' is unexpected
/run/build/python-poppler-qt5/poppler-annotation.sip: line 651 column 39: '=' is unexpected
/run/build/python-poppler-qt5/poppler-annotation.sip: line 652 column 40: '=' is unexpected
/run/build/python-poppler-qt5/poppler-annotation.sip: line 662 column 5: '}' is unexpected
/run/build/python-poppler-qt5/poppler-annotation.sip: line 685 column 3: 'private' is unexpected
/run/build/python-poppler-qt5/poppler-annotation.sip: line 689 column 1: too many '%End' directives
/run/build/python-poppler-qt5/poppler-annotation.sip: line 691 column 1: '}' is unexpected
/run/build/python-poppler-qt5/poppler-annotation.sip: line 1228 column 1: '}' is unexpected
FB: host_command_exited_cb 2826373 256

I guess that poppler-annotation.sip is not compliant with the sip-install version I'm using?
As I cannot control the sip version used by PyQt.BaseApp, can you upgrade this file?

PyQt.BaseApp is using sip 6.6.1 and and PyQt5-sip 12.10.1.

install fails with sip: "convertDate() has overloaded functions

here's the full error message:


building 'popplerqt5' extension
/usr/bin/sip -I /usr/share/sip -t POPPLER_V0_74_0 -c /var/tmp/portage/dev-python/python-poppler-qt5-9999/work/python-poppler-qt5-9999-python3_6/temp.linux-x86_64-3.6 -b /var/tmp/portage/dev-python/python-poppler-qt5-9999/work/python-poppler-qt5-9999-python3_6/temp.linux-x86_64-3.6/poppler-qt5.sbf -I /usr/share/sip/PyQt5 -n PyQt5.sip -t WS_X11 -t Qt_5_13_0 poppler-qt5.sip
sip: poppler-qt5.sip:54: ::Poppler::convertDate() has overloaded functions with the same Python signature
error: command '/usr/bin/sip' failed with exit status 1

my sip is version 4.19.19, installed the 3rd of Oct.

Cheers

Return all the text on a page not working with `page.text()`

Thanks for maintaining this library! I have been looking for a way to extract text and annotations from PDFs and this might be it!

I have run into a problem when trying to extract the text from a page. According to the QtPoppler manual page.text() should return the entire page's text when invoked without arguments (at least I believe that is what "If rect is null, all text on the page is given" means). However, when I try this I get an error:

import popplerqt5

doc = popplerqt5.Poppler.Document.load('./test1.pdf')
page = doc.page(0)
page.text()

Out:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: Page.text(): arguments did not match any overloaded call:
  overload 1: not enough arguments
  overload 2: not enough arguments

This is the test file test1.pdf. How can I return all the text on a page?

'python3 setup.py build' fails to detect c++11 compiler

I've been using a c++11-compatible gcc for about a year now, but running the command above fails with:

$ python3 setup.py build
running build
running build_ext
building 'popplerqt5' extension
x86_64-pc-linux-gnu-g++ -pthread -fPIC -I/usr/include/poppler/qt5 -I/usr/include/poppler -I/usr/include/python3.5m -I/usr/include/python3.5m -I/usr/include/qt5 -I/usr/include/qt5/QtCore -I/usr/include/qt5/QtGui -I/usr/include/qt5/QtXml -c build/temp.linux-x86_64-3.5/sippopplerqt5cmodule.cpp -o build/temp.linux-x86_64-3.5/build/temp.linux-x86_64-3.5/sippopplerqt5cmodule.o
In file included from /usr/include/qt5/QtCore/qglobal.h:83:0,
from /usr/include/qt5/QtCore/qmetatype.h:44,
from /usr/include/qt5/QtCore/QMetaType:1,
from build/temp.linux-x86_64-3.5/sipAPIpopplerqt5.h:12,
from build/temp.linux-x86_64-3.5/sippopplerqt5cmodule.cpp:7:
/usr/include/qt5/QtCore/qcompilerdetection.h:562:6: error: #error Qt requires a C++11 compiler and yours does not seem to be that.
# error Qt requires a C++11 compiler and yours does not seem to be that.

and then a long string of errors about undeclared functions.

I have python-poppler-qt5 pulled from git, current as of this message. I had also posted some more information on frescobaldi/frescobaldi#838, but which I now see was already closed by @uliska (so you might not have seen it).

My sip version is 4.19; I understand that there may be issues with ABI incompatibility with changing versions of sip. Might this be the issue? Or is something else going on here?

support for poppler 21.12.0?

I get the error:

Package 'poppler-qt5' requires 'poppler = 21.11.0' but version of poppler is 21.12.0

Is there not support for poppler 21.12.0?

Cannot pip install on Windows for Python 3.8

This is the error I got.

    ERROR: Command errored out with exit status 1:
     command: 'c:\users\nr\appdata\local\programs\python\python38\python.exe' 'c:\users\nr\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\NAVANE~1\AppData\Local\Temp\tmpl2ofr68s'
         cwd: C:\Users\nr\AppData\Local\Temp\pip-install-3q_63930\python-poppler-qt5_14fb155b4f024ed2aaa88cf0408bde0b
    Complete output (29 lines):
    Traceback (most recent call last):
      File "c:\users\nr\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 126, in prepare_metadata_for_build_wheel
        hook = backend.prepare_metadata_for_build_wheel
    AttributeError: module 'sipbuild.api' has no attribute 'prepare_metadata_for_build_wheel'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "c:\users\nr\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 280, in <module>
        main()
      File "c:\users\nr\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 263, in main
        json_out['return_val'] = hook(**hook_input['kwargs'])
      File "c:\users\nr\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 130, in prepare_metadata_for_build_wheel
        return _get_wheel_metadata_from_wheel(backend, metadata_directory,
      File "c:\users\nr\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 159, in _get_wheel_metadata_from_wheel
        whl_basename = backend.build_wheel(metadata_directory, config_settings)
      File "C:\Users\nr\AppData\Local\Temp\pip-build-env-1h9o6_ak\overlay\Lib\site-packages\sipbuild\api.py", line 51, in build_wheel
        project = AbstractProject.bootstrap('pep517')
      File "C:\Users\nr\AppData\Local\Temp\pip-build-env-1h9o6_ak\overlay\Lib\site-packages\sipbuild\abstract_project.py", line 83, in bootstrap
        project.setup(pyproject, tool, tool_description)
      File "C:\Users\nr\AppData\Local\Temp\pip-build-env-1h9o6_ak\overlay\Lib\site-packages\sipbuild\project.py", line 484, in setup
        self.apply_user_defaults(tool)
      File "C:\Users\nr\AppData\Local\Temp\pip-build-env-1h9o6_ak\overlay\Lib\site-packages\pyqtbuild\project.py", line 70, in apply_user_defaults
        super().apply_user_defaults(tool)
      File "C:\Users\nr\AppData\Local\Temp\pip-build-env-1h9o6_ak\overlay\Lib\site-packages\sipbuild\project.py", line 230, in apply_user_defaults
        self.builder.apply_user_defaults(tool)
      File "C:\Users\nr\AppData\Local\Temp\pip-build-env-1h9o6_ak\overlay\Lib\site-packages\pyqtbuild\builder.py", line 66, in apply_user_defaults
        raise PyProjectOptionException('qmake',
    sipbuild.pyproject.PyProjectOptionException
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/70/13/264e20336f7951044a8dd49cb1460bd318e2ebacff1753f908e6544ec933/python-poppler-qt5-21.1.0.tar.gz#sha256=add766db2c04026a6087f38f2044e66c8b053c81002f3753d8059713497d022d (from https://pypi.org/simple/python-poppler-qt5/). Command errored out with exit status 1: 'c:\users\nr\appdata\local\programs\python\python38\python.exe' 'c:\users\nr\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\NAVANE~1\AppData\Local\Temp\tmpl2ofr68s' Check the logs for full command output.
  Using cached python-poppler-qt5-0.75.0.tar.gz (23 kB)
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\nr\appdata\local\programs\python\python38\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\nr\\AppData\\Local\\Temp\\pip-install-3q_63930\\python-poppler-qt5_e21bf3fa589b46e88d7613f40c6fc03a\\setup.py'"'"'; __file__='"'"'C:\\Users\\nr\\AppData\\Local\\Temp\\pip-install-3q_63930\\python-poppler-qt5_e21bf3fa589b46e88d7613f40c6fc03a\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\nr\AppData\Local\Temp\pip-pip-egg-info-u4ilz46w'
         cwd: C:\Users\nr\AppData\Local\Temp\pip-install-3q_63930\python-poppler-qt5_e21bf3fa589b46e88d7613f40c6fc03a\
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\nr\AppData\Local\Temp\pip-install-3q_63930\python-poppler-qt5_e21bf3fa589b46e88d7613f40c6fc03a\setup.py", line 42, in <module>
        import sipdistutils
    ModuleNotFoundError: No module named 'sipdistutils'
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/6a/7d/65a14ece5dd6a1564b576c1ca30b0f5639be64cc55b62b4d2b497159ed43/python-poppler-qt5-0.75.0.tar.gz#sha256=ea0ec9ebe995705ab19a301290365652e62bab5c9b05db5697c7bf2173335107 (from https://pypi.org/simple/python-poppler-qt5/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  Using cached python-poppler-qt5-0.74.0.tar.gz (23 kB)
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\nr\appdata\local\programs\python\python38\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\nr\\AppData\\Local\\Temp\\pip-install-3q_63930\\python-poppler-qt5_8c1afe86bb7b489b953def00accd0a5d\\setup.py'"'"'; __file__='"'"'C:\\Users\\nr\\AppData\\Local\\Temp\\pip-install-3q_63930\\python-poppler-qt5_8c1afe86bb7b489b953def00accd0a5d\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\nr\AppData\Local\Temp\pip-pip-egg-info-snj3p98s'
         cwd: C:\Users\nr\AppData\Local\Temp\pip-install-3q_63930\python-poppler-qt5_8c1afe86bb7b489b953def00accd0a5d\
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\nr\AppData\Local\Temp\pip-install-3q_63930\python-poppler-qt5_8c1afe86bb7b489b953def00accd0a5d\setup.py", line 42, in <module>
        import sipdistutils
    ModuleNotFoundError: No module named 'sipdistutils'
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/c0/74/1479a3435ce3a68cb6f1de7cd60398c480893bcb5f6d7be2b7fa4c58f7a6/python-poppler-qt5-0.74.0.tar.gz#sha256=a21ad645d32c7544782587a01530378ff2718ad007a4ad5279a9783935a6086c (from https://pypi.org/simple/python-poppler-qt5/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  Using cached python-poppler-qt5-0.24.2.tar.gz (20 kB)
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\nr\appdata\local\programs\python\python38\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\nr\\AppData\\Local\\Temp\\pip-install-3q_63930\\python-poppler-qt5_ee34ab8ec3d24b768040d065f2cef45d\\setup.py'"'"'; __file__='"'"'C:\\Users\\nr\\AppData\\Local\\Temp\\pip-install-3q_63930\\python-poppler-qt5_ee34ab8ec3d24b768040d065f2cef45d\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\nr\AppData\Local\Temp\pip-pip-egg-info-ip21iy8j'
         cwd: C:\Users\nr\AppData\Local\Temp\pip-install-3q_63930\python-poppler-qt5_ee34ab8ec3d24b768040d065f2cef45d\
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\nr\AppData\Local\Temp\pip-install-3q_63930\python-poppler-qt5_ee34ab8ec3d24b768040d065f2cef45d\setup.py", line 42, in <module>
        import sipdistutils
    ModuleNotFoundError: No module named 'sipdistutils'
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/af/e7/aa451d4ca0910472c4442d8aa6ef44300852926d85ad033b029a22157027/python-poppler-qt5-0.24.2.tar.gz#sha256=3970c35ce1f0f1464a6c2746bea4c479b9780b4e17030c92479f7f1738a5c950 (from https://pypi.org/simple/python-poppler-qt5/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  Using cached python-poppler-qt5-0.24.1.tar.gz (17 kB)
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\nr\appdata\local\programs\python\python38\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\nr\\AppData\\Local\\Temp\\pip-install-3q_63930\\python-poppler-qt5_b21e9e1843204891be5bb719bada01d4\\setup.py'"'"'; __file__='"'"'C:\\Users\\nr\\AppData\\Local\\Temp\\pip-install-3q_63930\\python-poppler-qt5_b21e9e1843204891be5bb719bada01d4\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\nr\AppData\Local\Temp\pip-pip-egg-info-gjg4owbd'
         cwd: C:\Users\nr\AppData\Local\Temp\pip-install-3q_63930\python-poppler-qt5_b21e9e1843204891be5bb719bada01d4\
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\nr\AppData\Local\Temp\pip-install-3q_63930\python-poppler-qt5_b21e9e1843204891be5bb719bada01d4\setup.py", line 42, in <module>
        import sipdistutils
    ModuleNotFoundError: No module named 'sipdistutils'
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/26/41/81e7ee90baeeee2a5179af742edbac621ebf58d66b980f55547ef21e58f8/python-poppler-qt5-0.24.1.tar.gz#sha256=4254c4d5a1a76b13f8350815c90693bccee4705f4a1c8ad1021dd79f6b008c84 (from https://pypi.org/simple/python-poppler-qt5/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement python-poppler-qt5 (from versions: 0.24.1, 0.24.2, 0.74.0, 0.75.0, 21.1.0)
ERROR: No matching distribution found for python-poppler-qt5

Text Information extraction

Has anyone been able to extract each text box or each word info? As in the font name, size, colour all these things? I am trying to pass the SubType as popplerqt5.Poppler.TextAnnotation.AText in that page.annotations() as an argument but no luck extracting it. If someone has been able to extract any of the above information kindly help.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.