Skip to main content

Python API for PDFreactor

Project description

Python API for PDFreactor (https://www.pdfreactor.com), a HTML-to-PDF processor.

This distribution package is based on (and replaces) the original API module by RealObjects. To make use of it, you need

  • a running PDFreactor server

  • the keys needed to access it; depending on the server configuration:

Features

  • The module pdfreactor.api contains the Python API version 8 (based on wrappers/python/lib/PDFreactor.py from the PDFreactor tarball), suitable to talk to PDFreactor server versions 8 to 11.

Modifications

Here is an overview of the modifications in our distribution, compared to the original PDFreactor.py.

Structural changes

  • The original PDFreactor module from the server distribution tarball is called pdfreactor.api here.

  • The exception classes have been moved to the pdfreactor.exceptions module.

Compatible changes

Most code reduction measures don’t affect the usage of the PDFreactor class:

  • Generic changes to the code, e.g. Python version switches and imports (which are executed at runtime in Python) have been moved out of the methods to the top of the module.

  • Code to handle options is replaced by methods and a helper function:

    • For all methods which use a config argument: If none is given, create one, to take our client information.

    • The connectionSettings option is used by several methods and processed by an appropriate method.

    • A few methods accept an optional stream argument before another option. This is handled by a special function as well. Every legitimate usage should continue to work.

Incompatible changes

  • Reduced the number of exception classes:

    • All classes which inherit from ServerException have been removed, as well as the PDFreactor._createServerException method.

    • ServerException is an HTTPError now and sports a few additional read-only properties to provide the same information.

      This allowed us to greatly simplify the error handling code in the conversion methods.

    • If you wish to use all (remaining) exception classes of the package, import from the pdfreactor.exceptions module.

Installation

Simply install using pip:

pip install pdfreactor-api

Or, to integrate in a project built using zc.buildout, add to your buildout.cfg script:

[buildout]
...
eggs =
    pdfreactor-api

and then run bin/buildout.

Documentation

We expect most questions to be subject to the PDFreactor API documentation; see:

Examples

Some sample scripts by RealObjects are (minimally modified) contained in the docs/sample/ directory:

simple.py

A sample demonstrating the simple integration of PDFreactor into Python applications

async.py

A sample demonstrating an asynchronous integration which is recommended for medium to large documents

stream.py

A sample demonstrating how converted PDFs can be streamed, thus conserving memory

Contribute

(To this API distribution package:)

Support

If you are having issues concerning this API distribution (e.g. because of a new or modified API version by RealObjects), please let us know; please use the issue tracker mentioned above.

For issues regarding the PDFreactor itself, please refer to RealObjects.

License

The project is licensed under the MIT License.

Author

Changelog

1.8.0 (unreleased)

  • Initial release, providing a PDFreactor API v8. [tobiasherp]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pdfreactor-api-1.8.0.dev5.tar.gz (18.8 kB view details)

Uploaded Source

File details

Details for the file pdfreactor-api-1.8.0.dev5.tar.gz.

File metadata

  • Download URL: pdfreactor-api-1.8.0.dev5.tar.gz
  • Upload date:
  • Size: 18.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.5

File hashes

Hashes for pdfreactor-api-1.8.0.dev5.tar.gz
Algorithm Hash digest
SHA256 2bbbc6393e3db9f635df942cd1c8b0357034976fb7927e8dc1157d2c0b9a7b4b
MD5 78a12f3c411e8857c5c952e600fbdc36
BLAKE2b-256 fc1f5b5d0ee8b5351961d12d7ef7c8e25fed559639ceb6e877eb2e06adab9e95

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page