Minimum working example for testing Apryse PDF generation with annotations on client and server.
- document.loadCanvas does not return a canvas
- On MacOS, downloading the PDF (with annotations) from the webviewer and generating a PDF with the Python SDK produce different outputs.
-
Initialise a virtual environment
python3 -m venv venv && source venv/bin/activate
-
Install python requirements
pip install -r requirements.txt
-
Create env variable with apryse license
touch .env && echo "LICENSE=<key>" >> .env
-
Run flask application
python server.py
OR in docker container
docker build -t pdf-test . && docker run -p 8000:8000 pdf-test
-
Open browser to
http://127.0.0.1:8000/
to interact with Apryse webviwer. This loads and displays./test_img.jpeg
-
Click
Save Image
NB: This is currently broken. See browser console for error
-
Open browser to
http://127.0.0.1:8000/
to interact with Apryse webviwer. This loads and displays./test_img.jpeg
-
Add some annotations and click
Export Annotations
. This will save the xfdf sting of the annotations to./annotations.xml
-
Click
Generate PDF
. This will convert./test_img.jpeg
and add./annotations.xml
using the Apryse Python SDKs. Result is saved inoutput.pdf
-
Click Download PDF to view the generated pdf
├── templates
│ └── index.html # HTML and javascript for WebViewer UI
├── .gitignore
├── annotations.xml # Exported annotations
├── convert.py # Logic to convert image to PDF with annotations
├── Dockerfile
├── output.pdf # Generated PDF
├── README.md
├── requirements.txt
├── server.py # Flask server
└── test_img.jpeg # Test image