python-poppler
Advanced tools
+1
-1
@@ -14,3 +14,3 @@ cmake_minimum_required(VERSION 3.6) | ||
| find_package(PkgConfig REQUIRED) | ||
| pkg_check_modules(POPPLER REQUIRED IMPORTED_TARGET poppler-cpp>=0.62.0) | ||
| pkg_check_modules(POPPLER REQUIRED IMPORTED_TARGET poppler-cpp>=0.26.0) | ||
@@ -17,0 +17,0 @@ add_library(global_ MODULE src/cpp/global.cpp) |
+11
-117
| Metadata-Version: 2.1 | ||
| Name: python-poppler | ||
| Version: 0.2.1 | ||
| Version: 0.2.2 | ||
| Summary: A Python binding to poppler-cpp | ||
@@ -9,2 +9,3 @@ Home-page: https://github.com/cbrunet/python-poppler | ||
| License: GPLv2 | ||
| Project-URL: Documentation, https://cbrunet.github.io/python-poppler | ||
| Project-URL: Source, https://github.com/cbrunet/python-poppler | ||
@@ -29,125 +30,17 @@ Project-URL: Tracker, https://github.com/cbrunet/python-poppler/issues | ||
| # Download | ||
| # Documentation | ||
| ## Requirements | ||
| https://cbrunet.github.io/python-poppler/ | ||
| You nedd Python version 3.7 or 3.8. | ||
| You will also need the usual build tools (cmake, gcc...) | ||
| Documentation is currently a work-in-progress. Here you will find information about | ||
| installation of the package, compilation from sources, and usage. | ||
| This package is currently distributed as source only, and is currently tested on Linux only. | ||
| It requires poppler 0.62 or higher (but 0.87 or higher is recommended). | ||
| I will provide a WIndows build once I figure out how to compile poppler for Windows. | ||
| Meanwhile, because it follows the interface of `poppler-cpp`, you can refer to the [documentation of the C++ library](https://poppler.freedesktop.org/api/cpp/namespacepoppler.html). | ||
| You need poppler-cpp with headers, python (3.7 or 3.8) with headers, and cmake. | ||
| On Arch linux, you need the [poppler](https://security.archlinux.org/package/poppler) package. | ||
| On Ubuntu, you need to install [libpoppler-cpp-dev](https://packages.ubuntu.com/bionic/libpoppler-cpp-dev). | ||
| ## Install from PyPI | ||
| Package is [available on PyPI](https://pypi.org/project/python-poppler/). | ||
| To install, you simply need to issue the following command, preferabily in a python virtual environment: | ||
| ``` | ||
| $ pip install python-poppler | ||
| ``` | ||
| ## Install from git sources | ||
| Sources are [available on GitHub](https://github.com/cbrunet/python-poppler): | ||
| ``` | ||
| git clone --recurse-submodules https://github.com/cbrunet/python-poppler.git | ||
| ``` | ||
| [pybind11](https://pybind11.readthedocs.io/en/stable/) sources are included as submodule. | ||
| If you cloned the repository without the submodules, you can | ||
| get them with the command | ||
| ``` | ||
| git submodule update --init --recurse | ||
| ``` | ||
| If you want to use an installed version of pybind11 | ||
| instead of the submodule, you can replace `add_subdirectory(pybind11)` | ||
| by `find_package(pybind11)` in the [CMakeLists.txt] file. | ||
| The whole build process is handled by the `setup.py` file. | ||
| It will invoke the needed cmake commands, and install the files | ||
| at the right place. | ||
| For instance, to install in the current environment: | ||
| ``` | ||
| $ python setup.py install | ||
| ``` | ||
| This will compile the binary packages, and install the library. | ||
| Tests are run using [tox](https://tox.readthedocs.io/en/latest/): | ||
| ``` | ||
| $ tox | ||
| ``` | ||
| ## Building from Poppler sources | ||
| ``` | ||
| $ git clone https://gitlab.freedesktop.org/poppler/poppler.git | ||
| $ cd poppler | ||
| $ git checkout poppler-0.89.0 | ||
| $ mkdir build | ||
| $ cd build | ||
| $ cmake \ | ||
| -DCMAKE_BUILD_TYPE=Release \ | ||
| -DCMAKE_INSTALL_PREFIX:PATH=/usr/local \ | ||
| -DENABLE_UNSTABLE_API_ABI_HEADERS=ON \ | ||
| -DBUILD_GTK_TESTS=OFF \ | ||
| -DBUILD_QT5_TESTS=OFF \ | ||
| -DBUILD_CPP_TESTS=OFF \ | ||
| -DENABLE_CPP=ON \ | ||
| -DENABLE_GLIB=OFF \ | ||
| -DENABLE_GOBJECT_INTROSPECTION=OFF \ | ||
| -DENABLE_GTK_DOC=OFF \ | ||
| -DENABLE_QT5=OFF \ | ||
| -DBUILD_SHARED_LIBS=ON \ | ||
| .. | ||
| $ make | ||
| $ mkdir ../dist | ||
| $ sudo make install | ||
| ``` | ||
| You can omit the `git checkout` step if you want to work on HEAD. | ||
| To find the right version of poppler when compiling python-poppler, | ||
| you can set the `PKG_CONFIG_PATH` env var: | ||
| ``` | ||
| export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig | ||
| $ cd python-poppler | ||
| $ python setup.py bdist_wheel | ||
| ``` | ||
| To build the wheel, you need the `wheel` package, if not already installed. | ||
| Alternatively, you could simply do `python setup.py install`, preferabily | ||
| in a virtual environment. | ||
| You may need to tell the system where to find the Poppler shared libraries, | ||
| by setting the `LD_LIBRARY_PATH` env var: | ||
| ``` | ||
| $ export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH | ||
| $ python | ||
| >>> import poppler | ||
| >>> poppler.version() | ||
| (0, 89, 0) | ||
| ``` | ||
| # Usage | ||
| The package is installed as `poppler`. It follows the interface of `poppler-cpp`. Therefore, you can refer to the [documentation of the C++ library](https://poppler.freedesktop.org/api/cpp/namespacepoppler.html). | ||
| The package is installed as `poppler`. | ||
| Example: | ||
@@ -187,3 +80,3 @@ | ||
| Please provide unit tests covering the new feature, or prooving | ||
| Please provide unit tests covering the new feature, or proving | ||
| that a bug is corrected, when possible. | ||
@@ -195,5 +88,6 @@ | ||
| Classifier: License :: OSI Approved :: GNU General Public License v2 (GPLv2) | ||
| Classifier: Programming Language :: Python :: 3.6 | ||
| Classifier: Programming Language :: Python :: 3.7 | ||
| Classifier: Programming Language :: Python :: 3.8 | ||
| Requires-Python: >=3.7 | ||
| Requires-Python: >=3.6 | ||
| Description-Content-Type: text/markdown |
+7
-115
@@ -18,125 +18,17 @@  | ||
| # Download | ||
| # Documentation | ||
| ## Requirements | ||
| https://cbrunet.github.io/python-poppler/ | ||
| You nedd Python version 3.7 or 3.8. | ||
| You will also need the usual build tools (cmake, gcc...) | ||
| Documentation is currently a work-in-progress. Here you will find information about | ||
| installation of the package, compilation from sources, and usage. | ||
| This package is currently distributed as source only, and is currently tested on Linux only. | ||
| It requires poppler 0.62 or higher (but 0.87 or higher is recommended). | ||
| I will provide a WIndows build once I figure out how to compile poppler for Windows. | ||
| Meanwhile, because it follows the interface of `poppler-cpp`, you can refer to the [documentation of the C++ library](https://poppler.freedesktop.org/api/cpp/namespacepoppler.html). | ||
| You need poppler-cpp with headers, python (3.7 or 3.8) with headers, and cmake. | ||
| On Arch linux, you need the [poppler](https://security.archlinux.org/package/poppler) package. | ||
| On Ubuntu, you need to install [libpoppler-cpp-dev](https://packages.ubuntu.com/bionic/libpoppler-cpp-dev). | ||
| ## Install from PyPI | ||
| Package is [available on PyPI](https://pypi.org/project/python-poppler/). | ||
| To install, you simply need to issue the following command, preferabily in a python virtual environment: | ||
| ``` | ||
| $ pip install python-poppler | ||
| ``` | ||
| ## Install from git sources | ||
| Sources are [available on GitHub](https://github.com/cbrunet/python-poppler): | ||
| ``` | ||
| git clone --recurse-submodules https://github.com/cbrunet/python-poppler.git | ||
| ``` | ||
| [pybind11](https://pybind11.readthedocs.io/en/stable/) sources are included as submodule. | ||
| If you cloned the repository without the submodules, you can | ||
| get them with the command | ||
| ``` | ||
| git submodule update --init --recurse | ||
| ``` | ||
| If you want to use an installed version of pybind11 | ||
| instead of the submodule, you can replace `add_subdirectory(pybind11)` | ||
| by `find_package(pybind11)` in the [CMakeLists.txt] file. | ||
| The whole build process is handled by the `setup.py` file. | ||
| It will invoke the needed cmake commands, and install the files | ||
| at the right place. | ||
| For instance, to install in the current environment: | ||
| ``` | ||
| $ python setup.py install | ||
| ``` | ||
| This will compile the binary packages, and install the library. | ||
| Tests are run using [tox](https://tox.readthedocs.io/en/latest/): | ||
| ``` | ||
| $ tox | ||
| ``` | ||
| ## Building from Poppler sources | ||
| ``` | ||
| $ git clone https://gitlab.freedesktop.org/poppler/poppler.git | ||
| $ cd poppler | ||
| $ git checkout poppler-0.89.0 | ||
| $ mkdir build | ||
| $ cd build | ||
| $ cmake \ | ||
| -DCMAKE_BUILD_TYPE=Release \ | ||
| -DCMAKE_INSTALL_PREFIX:PATH=/usr/local \ | ||
| -DENABLE_UNSTABLE_API_ABI_HEADERS=ON \ | ||
| -DBUILD_GTK_TESTS=OFF \ | ||
| -DBUILD_QT5_TESTS=OFF \ | ||
| -DBUILD_CPP_TESTS=OFF \ | ||
| -DENABLE_CPP=ON \ | ||
| -DENABLE_GLIB=OFF \ | ||
| -DENABLE_GOBJECT_INTROSPECTION=OFF \ | ||
| -DENABLE_GTK_DOC=OFF \ | ||
| -DENABLE_QT5=OFF \ | ||
| -DBUILD_SHARED_LIBS=ON \ | ||
| .. | ||
| $ make | ||
| $ mkdir ../dist | ||
| $ sudo make install | ||
| ``` | ||
| You can omit the `git checkout` step if you want to work on HEAD. | ||
| To find the right version of poppler when compiling python-poppler, | ||
| you can set the `PKG_CONFIG_PATH` env var: | ||
| ``` | ||
| export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig | ||
| $ cd python-poppler | ||
| $ python setup.py bdist_wheel | ||
| ``` | ||
| To build the wheel, you need the `wheel` package, if not already installed. | ||
| Alternatively, you could simply do `python setup.py install`, preferabily | ||
| in a virtual environment. | ||
| You may need to tell the system where to find the Poppler shared libraries, | ||
| by setting the `LD_LIBRARY_PATH` env var: | ||
| ``` | ||
| $ export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH | ||
| $ python | ||
| >>> import poppler | ||
| >>> poppler.version() | ||
| (0, 89, 0) | ||
| ``` | ||
| # Usage | ||
| The package is installed as `poppler`. It follows the interface of `poppler-cpp`. Therefore, you can refer to the [documentation of the C++ library](https://poppler.freedesktop.org/api/cpp/namespacepoppler.html). | ||
| The package is installed as `poppler`. | ||
| Example: | ||
@@ -176,3 +68,3 @@ | ||
| Please provide unit tests covering the new feature, or prooving | ||
| Please provide unit tests covering the new feature, or proving | ||
| that a bug is corrected, when possible. |
+3
-1
@@ -90,2 +90,3 @@ import os | ||
| "License :: OSI Approved :: GNU General Public License v2 (GPLv2)", | ||
| "Programming Language :: Python :: 3.6", | ||
| "Programming Language :: Python :: 3.7", | ||
@@ -96,6 +97,7 @@ "Programming Language :: Python :: 3.8", | ||
| project_urls={ | ||
| "Documentation": "https://cbrunet.github.io/python-poppler", | ||
| "Source": "https://github.com/cbrunet/python-poppler", | ||
| "Tracker": "https://github.com/cbrunet/python-poppler/issues", | ||
| }, | ||
| python_requires=">=3.7", | ||
| python_requires=">=3.6", | ||
| packages=find_packages("src"), | ||
@@ -102,0 +104,0 @@ package_dir={"": "src"}, |
@@ -110,2 +110,3 @@ /* poppler-python: python binding to the poppler-cpp pdf lib | ||
| .def("fonts", &document::fonts) | ||
| #if HAS_VERSION(0, 46) | ||
| .def("get_author", &document::get_author) | ||
@@ -116,7 +117,10 @@ .def("get_creation_date", &document::get_creation_date) | ||
| .def("get_modification_date", &document::get_modification_date) | ||
| #endif | ||
| .def("get_pdf_id", &binding::pdf_id) | ||
| .def("get_pdf_version", &binding::pdf_version) | ||
| #if HAS_VERSION(0, 46) | ||
| .def("get_producer", &document::get_producer) | ||
| .def("get_subject", &document::get_subject) | ||
| .def("get_title", &document::get_title) | ||
| #endif | ||
| .def("has_embedded_files", &document::has_embedded_files) | ||
@@ -134,2 +138,3 @@ .def("has_permission", &document::has_permission, py::arg("which")) | ||
| .def("pages", &document::pages) | ||
| #if HAS_VERSION(0, 46) | ||
| .def("remove_info", &document::remove_info) | ||
@@ -148,2 +153,3 @@ .def("save", &document::save, py::arg("file_name")) | ||
| .def("set_title", &document::set_title, py::arg("title")) | ||
| #endif | ||
| .def("unlock", &document::unlock, py::arg("owner_password"), py::arg("user_password")); | ||
@@ -150,0 +156,0 @@ |
@@ -53,3 +53,3 @@ /* poppler-python: python binding to the poppler-cpp pdf lib | ||
| { static_cast<py::ssize_t>(img.height()), static_cast<py::ssize_t>(img.width()), bytes_per_color }, | ||
| { static_cast<py::ssize_t>(img.bytes_per_row()), bytes_per_color, 1L } | ||
| { static_cast<py::ssize_t>(img.bytes_per_row()), bytes_per_color, static_cast<py::ssize_t>(1L) } | ||
| ); | ||
@@ -56,0 +56,0 @@ } |
@@ -19,5 +19,5 @@ # poppler-python: python binding to the poppler-cpp pdf lib | ||
| __author__ = "Charles Brunet" | ||
| __version__ = "0.2.1" | ||
| __version__ = "0.2.2" | ||
| __version_info__ = tuple(map(int, __version__.split('.'))) | ||
| __all__ = ["__author__", "__version__", "__version_info__"] |
+36
-23
@@ -56,4 +56,5 @@ # poppler-python: python binding to the poppler-cpp pdf lib | ||
| def __init__(self, poppler_document): | ||
| def __init__(self, poppler_document, data=None): | ||
| self._document = poppler_document | ||
| self._data = data | ||
@@ -76,8 +77,9 @@ @ensure_unlocked | ||
| def author(self): | ||
| return str(self._document.get_author()) | ||
| return self.info_key("Author") | ||
| @author.setter | ||
| @since(0, 46) | ||
| @ensure_unlocked | ||
| def author(self, author): | ||
| self._document.set_author(ustring(author)) | ||
| self.set_info_key("Author", author) | ||
@@ -87,9 +89,9 @@ @property | ||
| def creation_date(self): | ||
| timestamp = self._document.get_creation_date() | ||
| return from_time_type(timestamp) | ||
| return self.info_date("CreationDate") | ||
| @creation_date.setter | ||
| @since(0, 46) | ||
| @ensure_unlocked | ||
| def creation_date(self, creation_date): | ||
| self._document.set_creation_date(to_time_type(creation_date)) | ||
| self.set_info_date("CreationDate", creation_date) | ||
@@ -99,8 +101,9 @@ @property | ||
| def creator(self): | ||
| return str(self._document.get_creator()) | ||
| return self.info_key("Creator") | ||
| @creator.setter | ||
| @since(0, 46) | ||
| @ensure_unlocked | ||
| def creator(self, creator): | ||
| self._document.set_creator(ustring(creator)) | ||
| self.set_info_key("Creator", creator) | ||
@@ -110,8 +113,9 @@ @property | ||
| def keywords(self): | ||
| return str(self._document.get_keywords()) | ||
| return self.info_key("Keywords") | ||
| @keywords.setter | ||
| @since(0, 46) | ||
| @ensure_unlocked | ||
| def keywords(self, keywords): | ||
| self._document.set_keywords(ustring(keywords)) | ||
| self.set_info_key("Keywords", keywords) | ||
@@ -127,9 +131,9 @@ @property | ||
| def modification_date(self): | ||
| timestamp = self._document.get_modification_date() | ||
| return from_time_type(timestamp) | ||
| return self.info_date("ModDate") | ||
| @modification_date.setter | ||
| @since(0, 46) | ||
| @ensure_unlocked | ||
| def modification_date(self, modification_date): | ||
| self._document.set_modification_date(to_time_type(modification_date)) | ||
| self.set_info_date("ModDate", modification_date) | ||
@@ -147,8 +151,9 @@ @property | ||
| def producer(self): | ||
| return str(self._document.get_producer()) | ||
| return self.info_key("Producer") | ||
| @producer.setter | ||
| @since(0, 46) | ||
| @ensure_unlocked | ||
| def producer(self, producer): | ||
| self._document.set_producer(ustring(producer)) | ||
| self.set_info_key("Producer", producer) | ||
@@ -158,8 +163,9 @@ @property | ||
| def subject(self): | ||
| return str(self._document.get_subject()) | ||
| return self.info_key("Subject") | ||
| @subject.setter | ||
| @since(0, 46) | ||
| @ensure_unlocked | ||
| def subject(self, subject): | ||
| self._document.set_subject(ustring(subject)) | ||
| self.set_info_key("Subject", subject) | ||
@@ -169,8 +175,9 @@ @property | ||
| def title(self): | ||
| return str(self._document.get_title()) | ||
| return self.info_key("Title") | ||
| @title.setter | ||
| @since(0, 46) | ||
| @ensure_unlocked | ||
| def title(self, title): | ||
| self._document.set_title(ustring(title)) | ||
| self.set_info_key("Title", title) | ||
@@ -210,2 +217,3 @@ @property | ||
| @since(0, 46) | ||
| @ensure_unlocked | ||
@@ -231,2 +239,3 @@ def set_info_date(self, key, val): | ||
| @since(0, 46) | ||
| @ensure_unlocked | ||
@@ -259,2 +268,3 @@ def set_info_key(self, key, val): | ||
| @since(0, 46) | ||
| @ensure_unlocked | ||
@@ -264,2 +274,3 @@ def remove_info(self): | ||
| @since(0, 46) | ||
| @ensure_unlocked | ||
@@ -269,2 +280,3 @@ def save(self, file_name): | ||
| @since(0, 46) | ||
| @ensure_unlocked | ||
@@ -288,3 +300,4 @@ def save_a_copy(self, file_name): | ||
| return Document( | ||
| document.load_from_data(file_data, owner_password or "", user_password or "") | ||
| document.load_from_data(file_data, owner_password or "", user_password or ""), | ||
| file_data | ||
| ) | ||
@@ -308,3 +321,3 @@ | ||
| @load.register | ||
| @load.register(str) | ||
| def _(arg: str, owner_password=None, user_password=None): | ||
@@ -314,3 +327,3 @@ return load_from_file(arg, owner_password, user_password) | ||
| @load.register | ||
| @load.register(Path) | ||
| def _(arg: Path, owner_password=None, user_password=None): | ||
@@ -320,4 +333,4 @@ return load_from_file(arg, owner_password, user_password) | ||
| @load.register | ||
| @load.register(bytes) | ||
| def _(arg: bytes, owner_password=None, user_password=None): | ||
| return load_from_data(arg, owner_password, user_password) |
@@ -27,5 +27,13 @@ # poppler-python: python binding to the poppler-cpp pdf lib | ||
| RenderHint = page_renderer.render_hint | ||
| """A flag of an option taken into account when rendering""" | ||
| class PageRenderer: | ||
| """:class:`PageRenderer` allows to render a :class:`.Page` object | ||
| to an :class:`.Image`. | ||
| It is a wrapper for :class:`poppler.cpp.page_renderer.page_renderer`. | ||
| """ | ||
| def __init__(self): | ||
@@ -89,2 +97,12 @@ self._renderer = page_renderer.page_renderer() | ||
| def can_render(): | ||
| """Tell whether poppler was compiled with the Splash render backend. | ||
| This should always return True. If it returns False, | ||
| :meth:`.render_page` will systematically return | ||
| an invalid :class:`.Image`. | ||
| Returns: | ||
| bool: whether a render backend was compiled with poppler. | ||
| """ | ||
| return page_renderer.can_render() |
@@ -18,2 +18,7 @@ # poppler-python: python binding to the poppler-cpp pdf lib | ||
| """This module contains utility functions that are not part of | ||
| poppler-cpp, but that helps interacting with it. | ||
| """ | ||
| from datetime import datetime | ||
@@ -26,2 +31,12 @@ import functools | ||
| def from_time_type(timestamp): | ||
| """Convert a timestamp to a :class:`datetime.datetime` object. | ||
| Args: | ||
| timestamp (int): a positive integer, to be interpreted as 32 bits complement 2. | ||
| Returns: | ||
| Optional[datetime.datetime]: the date and time, | ||
| or None if the timestamp is equivalent to -1. | ||
| """ | ||
| if timestamp == 2 ** 32 - 1: | ||
@@ -33,2 +48,12 @@ return None | ||
| def to_time_type(date_time): | ||
| """Convert a Python :class:`datetime.datetime` object | ||
| to a timestamp compatible with poppler. | ||
| Args: | ||
| date_time (Optional[datetime.datetime]): the date and time, or None | ||
| Returns: | ||
| int: the timestamp | ||
| """ | ||
| return int(date_time.timestamp()) if date_time else 2 ** 32 - 1 | ||
@@ -38,13 +63,30 @@ | ||
| def version(): | ||
| """Get poppler version, as a tuple | ||
| Returns: | ||
| Tuple[int, int, int]: (major, minor, micro) | ||
| """ | ||
| return version_major(), version_minor(), version_micro() | ||
| def since(maj, min): | ||
| def since(major, minor): | ||
| """Decorator used to mark the minimum required version of poppler | ||
| needed to execute a function. | ||
| If poppler version is lower than the specified version, | ||
| it raises a NotImplementedError when called. | ||
| Args: | ||
| major (int): major version number | ||
| minor (int): minor version number | ||
| """ | ||
| def wrapper(fct): | ||
| @functools.wraps(fct) | ||
| def wrapped(*args, **kwargs): | ||
| if version() < (maj, min, 0): | ||
| if version() < (major, minor, 0): | ||
| raise NotImplementedError( | ||
| "This functionality requires at least Poppler version {}".format( | ||
| ".".join(map(str, (maj, min, 0))) | ||
| ".".join(map(str, (major, minor, 0))) | ||
| ) | ||
@@ -51,0 +93,0 @@ ) |
| Metadata-Version: 2.1 | ||
| Name: python-poppler | ||
| Version: 0.2.1 | ||
| Version: 0.2.2 | ||
| Summary: A Python binding to poppler-cpp | ||
@@ -9,2 +9,3 @@ Home-page: https://github.com/cbrunet/python-poppler | ||
| License: GPLv2 | ||
| Project-URL: Documentation, https://cbrunet.github.io/python-poppler | ||
| Project-URL: Source, https://github.com/cbrunet/python-poppler | ||
@@ -29,125 +30,17 @@ Project-URL: Tracker, https://github.com/cbrunet/python-poppler/issues | ||
| # Download | ||
| # Documentation | ||
| ## Requirements | ||
| https://cbrunet.github.io/python-poppler/ | ||
| You nedd Python version 3.7 or 3.8. | ||
| You will also need the usual build tools (cmake, gcc...) | ||
| Documentation is currently a work-in-progress. Here you will find information about | ||
| installation of the package, compilation from sources, and usage. | ||
| This package is currently distributed as source only, and is currently tested on Linux only. | ||
| It requires poppler 0.62 or higher (but 0.87 or higher is recommended). | ||
| I will provide a WIndows build once I figure out how to compile poppler for Windows. | ||
| Meanwhile, because it follows the interface of `poppler-cpp`, you can refer to the [documentation of the C++ library](https://poppler.freedesktop.org/api/cpp/namespacepoppler.html). | ||
| You need poppler-cpp with headers, python (3.7 or 3.8) with headers, and cmake. | ||
| On Arch linux, you need the [poppler](https://security.archlinux.org/package/poppler) package. | ||
| On Ubuntu, you need to install [libpoppler-cpp-dev](https://packages.ubuntu.com/bionic/libpoppler-cpp-dev). | ||
| ## Install from PyPI | ||
| Package is [available on PyPI](https://pypi.org/project/python-poppler/). | ||
| To install, you simply need to issue the following command, preferabily in a python virtual environment: | ||
| ``` | ||
| $ pip install python-poppler | ||
| ``` | ||
| ## Install from git sources | ||
| Sources are [available on GitHub](https://github.com/cbrunet/python-poppler): | ||
| ``` | ||
| git clone --recurse-submodules https://github.com/cbrunet/python-poppler.git | ||
| ``` | ||
| [pybind11](https://pybind11.readthedocs.io/en/stable/) sources are included as submodule. | ||
| If you cloned the repository without the submodules, you can | ||
| get them with the command | ||
| ``` | ||
| git submodule update --init --recurse | ||
| ``` | ||
| If you want to use an installed version of pybind11 | ||
| instead of the submodule, you can replace `add_subdirectory(pybind11)` | ||
| by `find_package(pybind11)` in the [CMakeLists.txt] file. | ||
| The whole build process is handled by the `setup.py` file. | ||
| It will invoke the needed cmake commands, and install the files | ||
| at the right place. | ||
| For instance, to install in the current environment: | ||
| ``` | ||
| $ python setup.py install | ||
| ``` | ||
| This will compile the binary packages, and install the library. | ||
| Tests are run using [tox](https://tox.readthedocs.io/en/latest/): | ||
| ``` | ||
| $ tox | ||
| ``` | ||
| ## Building from Poppler sources | ||
| ``` | ||
| $ git clone https://gitlab.freedesktop.org/poppler/poppler.git | ||
| $ cd poppler | ||
| $ git checkout poppler-0.89.0 | ||
| $ mkdir build | ||
| $ cd build | ||
| $ cmake \ | ||
| -DCMAKE_BUILD_TYPE=Release \ | ||
| -DCMAKE_INSTALL_PREFIX:PATH=/usr/local \ | ||
| -DENABLE_UNSTABLE_API_ABI_HEADERS=ON \ | ||
| -DBUILD_GTK_TESTS=OFF \ | ||
| -DBUILD_QT5_TESTS=OFF \ | ||
| -DBUILD_CPP_TESTS=OFF \ | ||
| -DENABLE_CPP=ON \ | ||
| -DENABLE_GLIB=OFF \ | ||
| -DENABLE_GOBJECT_INTROSPECTION=OFF \ | ||
| -DENABLE_GTK_DOC=OFF \ | ||
| -DENABLE_QT5=OFF \ | ||
| -DBUILD_SHARED_LIBS=ON \ | ||
| .. | ||
| $ make | ||
| $ mkdir ../dist | ||
| $ sudo make install | ||
| ``` | ||
| You can omit the `git checkout` step if you want to work on HEAD. | ||
| To find the right version of poppler when compiling python-poppler, | ||
| you can set the `PKG_CONFIG_PATH` env var: | ||
| ``` | ||
| export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig | ||
| $ cd python-poppler | ||
| $ python setup.py bdist_wheel | ||
| ``` | ||
| To build the wheel, you need the `wheel` package, if not already installed. | ||
| Alternatively, you could simply do `python setup.py install`, preferabily | ||
| in a virtual environment. | ||
| You may need to tell the system where to find the Poppler shared libraries, | ||
| by setting the `LD_LIBRARY_PATH` env var: | ||
| ``` | ||
| $ export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH | ||
| $ python | ||
| >>> import poppler | ||
| >>> poppler.version() | ||
| (0, 89, 0) | ||
| ``` | ||
| # Usage | ||
| The package is installed as `poppler`. It follows the interface of `poppler-cpp`. Therefore, you can refer to the [documentation of the C++ library](https://poppler.freedesktop.org/api/cpp/namespacepoppler.html). | ||
| The package is installed as `poppler`. | ||
| Example: | ||
@@ -187,3 +80,3 @@ | ||
| Please provide unit tests covering the new feature, or prooving | ||
| Please provide unit tests covering the new feature, or proving | ||
| that a bug is corrected, when possible. | ||
@@ -195,5 +88,6 @@ | ||
| Classifier: License :: OSI Approved :: GNU General Public License v2 (GPLv2) | ||
| Classifier: Programming Language :: Python :: 3.6 | ||
| Classifier: Programming Language :: Python :: 3.7 | ||
| Classifier: Programming Language :: Python :: 3.8 | ||
| Requires-Python: >=3.7 | ||
| Requires-Python: >=3.6 | ||
| Description-Content-Type: text/markdown |
@@ -193,9 +193,2 @@ CMakeLists.txt | ||
| pybind11/tools/pybind11Tools.cmake | ||
| pybind11/tools/clang/.git | ||
| pybind11/tools/clang/.gitignore | ||
| pybind11/tools/clang/LICENSE.TXT | ||
| pybind11/tools/clang/README.md | ||
| pybind11/tools/clang/__init__.py | ||
| pybind11/tools/clang/cindex.py | ||
| pybind11/tools/clang/enumerations.py | ||
| src/cpp/destination.cpp | ||
@@ -202,0 +195,0 @@ src/cpp/document.cpp |
| #===- __init__.py - Clang Python Bindings --------------------*- python -*--===# | ||
| # | ||
| # The LLVM Compiler Infrastructure | ||
| # | ||
| # This file is distributed under the University of Illinois Open Source | ||
| # License. See LICENSE.TXT for details. | ||
| # | ||
| #===------------------------------------------------------------------------===# | ||
| r""" | ||
| Clang Library Bindings | ||
| ====================== | ||
| This package provides access to the Clang compiler and libraries. | ||
| The available modules are: | ||
| cindex | ||
| Bindings for the Clang indexing library. | ||
| """ | ||
| __all__ = ['cindex'] | ||
Sorry, the diff of this file is not supported yet
| *.swp | ||
| *.swo | ||
| *.pyc | ||
| __pycache__ |
Sorry, the diff of this file is too big to display
| #===- enumerations.py - Python Enumerations ------------------*- python -*--===# | ||
| # | ||
| # The LLVM Compiler Infrastructure | ||
| # | ||
| # This file is distributed under the University of Illinois Open Source | ||
| # License. See LICENSE.TXT for details. | ||
| # | ||
| #===------------------------------------------------------------------------===# | ||
| """ | ||
| Clang Enumerations | ||
| ================== | ||
| This module provides static definitions of enumerations that exist in libclang. | ||
| Enumerations are typically defined as a list of tuples. The exported values are | ||
| typically munged into other types or classes at module load time. | ||
| All enumerations are centrally defined in this file so they are all grouped | ||
| together and easier to audit. And, maybe even one day this file will be | ||
| automatically generated by scanning the libclang headers! | ||
| """ | ||
| # Maps to CXTokenKind. Note that libclang maintains a separate set of token | ||
| # enumerations from the C++ API. | ||
| TokenKinds = [ | ||
| ('PUNCTUATION', 0), | ||
| ('KEYWORD', 1), | ||
| ('IDENTIFIER', 2), | ||
| ('LITERAL', 3), | ||
| ('COMMENT', 4), | ||
| ] | ||
| __all__ = ['TokenKinds'] |
| ============================================================================== | ||
| LLVM Release License | ||
| ============================================================================== | ||
| University of Illinois/NCSA | ||
| Open Source License | ||
| Copyright (c) 2007-2012 University of Illinois at Urbana-Champaign. | ||
| All rights reserved. | ||
| Developed by: | ||
| LLVM Team | ||
| University of Illinois at Urbana-Champaign | ||
| http://llvm.org | ||
| Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
| this software and associated documentation files (the "Software"), to deal with | ||
| the Software without restriction, including without limitation the rights to | ||
| use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies | ||
| of the Software, and to permit persons to whom the Software is furnished to do | ||
| so, subject to the following conditions: | ||
| * Redistributions of source code must retain the above copyright notice, | ||
| this list of conditions and the following disclaimers. | ||
| * Redistributions in binary form must reproduce the above copyright notice, | ||
| this list of conditions and the following disclaimers in the | ||
| documentation and/or other materials provided with the distribution. | ||
| * Neither the names of the LLVM Team, University of Illinois at | ||
| Urbana-Champaign, nor the names of its contributors may be used to | ||
| endorse or promote products derived from this Software without specific | ||
| prior written permission. | ||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
| FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE | ||
| SOFTWARE. | ||
| ============================================================================== | ||
| The LLVM software contains code written by third parties. Such software will | ||
| have its own individual LICENSE.TXT file in the directory in which it appears. | ||
| This file will describe the copyrights, license, and restrictions which apply | ||
| to that code. | ||
| The disclaimer of warranty in the University of Illinois Open Source License | ||
| applies to all code in the LLVM Distribution, and nothing in any of the | ||
| other licenses gives permission to use the names of the LLVM Team or the | ||
| University of Illinois to endorse or promote products derived from this | ||
| Software. | ||
| The following pieces of software have additional or alternate copyrights, | ||
| licenses, and/or restrictions: | ||
| Program Directory | ||
| ------- --------- | ||
| <none yet> | ||
| This is simply clang's Python bindings (clang.cindex) ported to Python 3. Please see http://llvm.org/svn/llvm-project/cfe/trunk/bindings/python/ for the original project. | ||
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
1980537
-6.13%226
-3%7977
-27.28%