Package: pdfserver
Pdfserver is a webservice that offers common PDF operations like joining
documents, selecting pages or “n pages on one”. It is built on top of the
Python based microframework Flask and depends on pyPdf to manipulate PDFs.RationalePowerful tools to manipulate PDF exist but they are not universally
available on all systems or not simple to use. This server allows anyone to
quickly solve most common PDF operations over the web.If you don’t trust other servers with your data, deploy a copy yourself!ExampleSeehttp://pdfserverapp.appspot.com/for an example installation.Dependencies(seerequirements.txt)Python (>= 2.5, < 3.0),http://www.python.orgFlask (tested on 0.6),http://flask.pocoo.org/Flask-Babel,http://packages.python.org/Flask-Babel/Flask-Script (>= 0.3.1),http://bitbucket.org/danjac/flask-scriptSQLAlchemy (probably >= 0.6.0),http://www.sqlalchemy.org/pyPdf (>= 1.13),http://pybrary.net/pyPdf/Optionallypython-reportlab (tested with 2.4) for adding watermarks,http://www.reportlab.com/software/opensource/rl-toolkit/celery (tested with 2.0.0) for asynchronous request handling (not needed on
Google App Engine),http://celeryq.org/Already includedjQuery & jQuery UI (tested with 1.8.4) (both already shipped with pdfserver),
needs at least UI core, “Sortable” and “Dialog” from jQuery UI,http://jquery.com/jQuery plugin: Validation,http://bassistance.de/jquery-plugins/jquery-plugin-validation/jNotify jQuery Plug-in, unobtrusive notification systemhttp://www.givainc.com/labs/jnotify_jquery_plugin.htmFeaturesSimple, yet powerfulDesigned to work with&without JavascriptN pages on oneJoining of filesSelecting pages & page rangesRotate pagesAdd watermark to pagesRuns on the Google App EngineHandle builds asynchronouslyChanges0.6Use SQLAlchemy broker backend for celery by defaultFix breakage due to incompatible Flask changeFix test for ordering of uploaded files0.5Fix setup.py staticsShow warning if cookies not enabledUpdate pyPdf dependencyEnable testing for celery task backend0.4Handle upload and remove actions through AjaxSupport for asynchronous PDF generationFix max upload size handling for App EngineUnittestsAction messages0.3Renamed to “pdfserver” from “django-pdfserver”“N pages on one” featureMove to Flask from DjangoGoogle App Engine support0.2.1Page rotationWatermark featurePage range validationDeployDownload and extract the soure code.Create a virtualenv in the extracted folder and install requirements:$ virtualenv env
$ source env/bin/activate
$ pip install -r requirements.txtYou can simply run the development server with:$ python manage.py createdb
$ mkdir uploads
$ python manage.py runserverGeneralMake sure the given upload directory and database can be written to and are
not accessible from the outside (if on a public server).When not in debug mode make sure to serve static files understatic.Give aSECRET_KEYand keep it secret so that sessions can be signed and
users cannot see files uploaded by others.Create the database by running:$ python manage.py createdbCeleryFor optional, asynchronous generation of the resulting PDF install celery and
kombu-sqlalchemy (you may also use default broker RabbitMQ, seehttp://celeryq.org/docs/getting-started/broker-installation.html):$ pip install -r celery_requirements.txtRun celeryd from the project’s directory to handle tasks asynchronously:$ celerydThe Google App Engine has its own dereferred library which is automatically
used.Serve as CGISee pdfserver.cgi for an example on how to run pdfserver through the
traditional CGI interface.Google App EngineFor pdfserver to run on the App Engine you need to download and copy
dependencies locally. Run the following in the extracted folder:# Get dependencies
$ mkdir tmp
$ pip install -r requirements.txt distribute --build=tmp --src=tmp \
  --no-install --ignore-installed
$ mv tmp/Babel/babel/ tmp/Flask/flask/ tmp/Flask-Babel/flaskext/ \
  tmp/Jinja2/jinja2/ tmp/pyPdf/pyPdf/ tmp/pytz/pytz \
  tmp/speaklater/speaklater.py tmp/Werkzeug/werkzeug/ \
  tmp/reportlab/src/reportlab/ tmp/distribute/pkg_resources.py .
$ rm -rf tmp
# Add a secret key
$ $EDITOR appengine.py
# Choose your application name
$ $EDITOR app.yaml
# Run the development server
$ /usr/local/google_appengine/dev_appserver.py .
# Finally upload
$ /usr/local/google_appengine/appcfg.py update .If tasks won’t get executed (you can check underhttp://localhost:8080/_ah/admin/tasks?queue=default), you might got hitten
by bughttp://code.google.com/p/appengine-mapreduce/issues/detail?id=9,
see workaround there.ContactPlease report bugs tohttp://github.com/cburgmer/pdfserver/issues.Christoph Burgmer <cburgmer (at) ira uka de>