pdfdraw/server
2020-11-25 15:38:38 +01:00
..
.eslintrc.yml Initial Open Source checkin of version 0.1.0. 2020-11-25 15:38:38 +01:00
.gitignore Initial Open Source checkin of version 0.1.0. 2020-11-25 15:38:38 +01:00
annotate_pdfparser.py Initial Open Source checkin of version 0.1.0. 2020-11-25 15:38:38 +01:00
annotate_pypdf.py Initial Open Source checkin of version 0.1.0. 2020-11-25 15:38:38 +01:00
config.js.in Initial Open Source checkin of version 0.1.0. 2020-11-25 15:38:38 +01:00
package.json Initial Open Source checkin of version 0.1.0. 2020-11-25 15:38:38 +01:00
pdfannotate Initial Open Source checkin of version 0.1.0. 2020-11-25 15:38:38 +01:00
pdfdraw.service Initial Open Source checkin of version 0.1.0. 2020-11-25 15:38:38 +01:00
README.md Initial Open Source checkin of version 0.1.0. 2020-11-25 15:38:38 +01:00
server.js Initial Open Source checkin of version 0.1.0. 2020-11-25 15:38:38 +01:00

pdfdraw server

This document describes the pdfdraw server API.

Requirements

pdftk should be available as a package pdftk or pdftk-java.

The svg2pdf tool can be installed with

pip install svglib

Most Linux distributions provide pyPdf in a package like python-pypdf.

Preparation

Make sure all requirements are installed and can be executed from the user running the pdfdraw server.

Install the node dependencies by running npm install in the server folder.

Copy server.conf.in to server.conf and adjust to your requirements.

Running

The server can be started with node server.js, a systemd service script is provided in pdfdraw.service.

Annotation events

TODO: Describe the socket.io API.

Downloading PDFs

A client can download annotated PDF documents by sending a HTTP POST to the download endpoint.

Request parameters (sent as application/json):

  • token (string): The token used to access the file being annotated.
  • svg (string): The SVG data containing the annotations.
  • text (list): Optional list of text annotations to embedd in the PDF.

The text annotations are a list of objects that must contain the following fields:

  • page (number): Zero-based page number where the annotation should be added. Will default to the first page if nothing is given.
  • x (number): X position of the annotation.
  • y (number): Y position of the annotation.
  • text (string): The annotation text.
  • color (string): Optional HTML color of the annotation. PDF readers will use a default color if none is provided.
  • author (string): Optional author name to add to the annotation metadata.
  • modified (number): Optional timestamp (seconds since the epoch, in UTC) when the annotation was last modified.