Skip to main content

pp.server is a FastAPI based server implementation and implements the server side functionality of the Produce & Publish platform. It is known as the Produce & Publish Server.

The Produce & Publish Server provided web service APIs for converting HTML/XML + assets to PDF using one of the following external PDF converters:

  • PrinceXML (www.princexml.com, commercial)

  • PDFreactor (www.realobjects.com, commercial)

  • Speedata Publisher (www.speedata.de, open-source, experimental support)

  • WKHTMLTOPDF (www.wkhtmltopdf.org, open-source, experimental support)

  • Vivliostyle Formatter (www.vivliostyle.com, commercial, experimental support)

  • VersaType Formatter (www.trim-marks.com, commercial, experimental support)

  • Antennahouse 7 (www.antennahouse.com, commercial)

  • Weasyprint (free, unsupported)

  • Typeset.sh (www.typeset.sh, commercial)

  • PagedJS (www.pagedjs.org, free)

In addition there is experimental support for generating EPUB documents using Calibre (www.calibre.org, open-source).

The web service provides only synchronous operation.

Requirements

  • Python 3.12 or higher, no support for Python 2.x

  • the external binaries

    • PrinceXML: prince,

    • PDFreactor: pdfreactor.py,

    • Speedata Publisher: sp

    • Calibre: ebook-convert

    • WKHTMLTOPDF: wkhtmltopdf

    • Vivliostyle: vivliostyle-formatter

    • VersaType : versatype-converter

    • Weasyprint: weasyprint

    • Antennahouse: run.sh

    • Typeset.sh: typeset.sh.phar

    • PageJS: pagedjs-cli

    must be in the $PATH. Please refer to the installation documentation of the individual products.

Installation

This project uses uv as package and virtualenv manager.

  • create a Python 3 virtual environment using:

    python3 -m venv .venv
  • install dependencies using uv:

    .venv/bin/uv pip install -e .
  • run the Produce & Publish server using the pp-server script:

    .venv/bin/pp-server --host 0.0.0.0 --port 8000

    The pp-server script provides options for setting the host and port, and for enabling auto-reloading of the server on code changes.

  • or under control of gunicorn:

    .venv/bin/gunicorn pp.server.server:app -w 2 -k uvicorn.workers.UvicornWorker
  • For running the Produce & Publisher server under control of the process manager circus, generate the circusd.ini file using:

    .venv/bin/pp-server-templates
  • and start it in background:

    .venv/bin/circusd circusd.ini  --daemon

Converter requirements

For the PDF conversion the related converter binaries or scripts must be included in the $PATH of your server.

  • prince for PrinceXML

  • pdfreactor-legacy for PDFreactor <= 11

  • pdfreactor for PDFreactor 12 or highter

  • wkhtmltopdf for WKHTMLToPDF

  • ebook-convert for Calibre

  • sp for the Speedata Publisher

  • vivliostyle for the Vivliostyle formatter

  • versatype for the Versatype converter

  • weasyprint for Weasyprint

  • antennahouse for the Antennahouse

  • pagedjs for the PagedJS

  • typesetsh for the Typeset.sh

API documentation

All API methods are available through a REST api following API URL endpoint:

http://host:port/<command>

With the default server configuration this translates to:

http://localhost:8000/convert

REST API Introspection

pp.server is implemented based on the FastAPI framework for Python. You can access the REST API documentation directly through

http://localhost:8000/docs

Environment variables

pp.server uses the var folder of the installation directory by default as temporary folder for conversion data. Set the environment variable PP_SPOOL_DIRECTORY if you need different spool directory instead.

If you run PDFreactor 10 or higher under Docker then you must set the environment variable PP_PDFREACTOR_DOCKER=1 in order to generated a proper file:///docs/… URI for pdfreactor.py.

PDF conversion API

Remember that all converters use HTML or XML as input for the conversion. All input data (HTML/XML, images, stylesheets, fonts etc.) must be stored in ZIP archive. The filename of the content must be named index.html.

You have to POST the data to the

http://host:port/convert

with the following parameters:

  • data - the ZIP archive (as base64 encoded string)

  • converter - a string that determines the the PDF converter to be used (either princexml, pdfreactor, phantomjs, vivliostyle, versatype, or calibre for generating EPUB content)

  • cmd_options - an optional string of command line parameters added as given to the calls of the externals converters

Returns:

The API returns its result as JSON structure with the following key-value pairs:

  • status - either OK or ERROR

  • data- the generated PDF file encoded as base64 encoded byte string

  • output - the conversion transcript (output of the converter run)

Introspection API methods

Produce & Publish server version:

http://host:port/version

returns:

{“version”: “3.0.0”, “module”: “pp.server”}

Installed/available converters:

http://host:port/converters

returns:

{“pdfreactor”: true, “phantomjs”: false, “calibre”: true, “prince”: true}

Versions of installed converter:

http://host:port/converter-versions

returns:

{‘prince’: ‘Version x.y’, ‘pdfreactor: ‘Version a.b.c’, …}

Other API methods

Cleanup of the queue directory (removes conversion data older than one day)

http://host:port/cleanup

returns:

{“directories_removed”: 22}

Source code

https://github.com/zopyx/pp.server

Bug tracker

https://github.com/zopyx/pp.server/issues

Support

Support for Produce & Publish Server is currently only available on a project basis.

License

pp.server is published under the GNU Public License V2 (GPL 2).

Contact

ZOPYX
Hundskapfklinge 33
D-72074 Tuebingen, Germany
www.zopyx.com
www.produce-and-publish.info

Download files

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

Source Distribution

pp_server-3.5.7.tar.gz (115.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pp_server-3.5.7-py3-none-any.whl (112.6 kB view details)

Uploaded Python 3

File details

Details for the file pp_server-3.5.7.tar.gz.

File metadata

  • Download URL: pp_server-3.5.7.tar.gz
  • Upload date:
  • Size: 115.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.23

File hashes

Hashes for pp_server-3.5.7.tar.gz
Algorithm Hash digest
SHA256 da89f6cdb90ec7357d0a700f7d025b3259d3ef84c0638d432beb08ebe143f114
MD5 da6e707428be8a2f96b4d2f2c11b8b5b
BLAKE2b-256 9288f38f5452e2e1da2f93ea23b2148cac421fdbac951962716349776466232b

See more details on using hashes here.

File details

Details for the file pp_server-3.5.7-py3-none-any.whl.

File metadata

  • Download URL: pp_server-3.5.7-py3-none-any.whl
  • Upload date:
  • Size: 112.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.23

File hashes

Hashes for pp_server-3.5.7-py3-none-any.whl
Algorithm Hash digest
SHA256 82c611e38aa8b8be1e0a1e5422097e066eeef2a28adf63cf3bba56aeb07bab92
MD5 c377d1959c66000dbb5a20769aad5142
BLAKE2b-256 e0b5b7275fea828e42c7365cb8769ab4716829d7a26992adf33a345e1c12092e

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

3.5.7 This release

2 files

3.5.6

2 files

3.5.5

2 files

3.5.4

2 files

3.5.3

2 files

3.5.2

2 files

3.5.1

2 files

3.5.0

2 files

3.4.2

2 files

3.4.1

2 files

3.4.0

2 files

3.3.0.2

1 file

3.2.0.6

1 file

3.2.0.5

1 file

3.2.0.4

1 file

3.2.0.3

1 file

3.2.0.2

1 file

3.2.0.1

1 file

3.2.0

1 file

3.1.1

1 file

3.1

1 file

3.0.0.8

1 file

3.0.0.7

1 file

3.0.0.6

1 file

3.0.0.5

1 file

3.0.0.4

1 file

3.0.0.3

1 file

3.0.0.2

1 file

3.0.0.1

1 file

3.0.0

1 file

2.1.0

1 file

2.0.6.8

1 file

2.0.6.1

1 file

2.0.6

1 file

2.0.5

1 file

2.0.4

1 file

2.0.3

1 file

2.0.2

1 file

2.0.1

1 file

2.0

1 file

1.0.8.6

1 file

1.0.8.5

1 file

1.0.8.4

1 file

1.0.8.3

1 file

1.0.8.2

1 file

1.0.8.1

1 file

1.0.8

1 file

1.0.7.1

1 file

1.0.7

1 file

1.0.6.1

1 file

1.0.6

1 file

1.0.5.1

1 file

1.0.5

1 file

1.0.4

1 file

1.0.3

1 file

1.0.2

1 file

1.0.0

1 file

0.7.13

1 file

0.7.12

1 file

0.7.11

1 file

0.7.10

1 file

0.7.9

1 file

0.7.8

1 file

0.7.7

1 file

0.7.6

1 file

0.7.5

1 file

0.7.4

1 file

0.7.3

1 file

0.7.2

1 file

0.7.1

1 file

0.7.0.2

1 file

0.7.0.1

1 file

0.7.0

1 file

0.6.4

1 file

0.6.1

1 file

0.6.0

1 file

0.5.5

1 file

0.5.3

1 file

0.5.2

1 file

0.5.1

1 file

0.5.0

1 file

0.4.7

1 file

0.4.6

1 file

0.4.5

1 file

0.4.4

1 file

0.4.3

1 file

0.4.2

1 file

0.4.1

1 file

0.4.0

1 file

0.3.5

1 file

0.3.4

1 file

0.3.3

1 file

0.3.2

1 file

0.3.1

1 file

0.3.0

1 file

0.2.7

1 file

0.2.6

1 file

0.2.5

0.2.4

1 file

0.2.3

1 file

0.2.2

1 file

0.2.1

1 file

0.2.0

1 file

0.1.9

1 file

0.1.8

1 file

0.1.7

1 file

0.1.6

1 file

0.1.5

1 file

0.1.3

1 file

0.1.1

1 file

0.1

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page