The purpose of this script is to remove pages from a PDF document that contain QR Codes with data in the format of ASNXXXXXXX.
This script is meant to be used as a pre-consuption script for paperless-ngx
There are some documents that I did not want to add a sticker to, but still keep physical copies. In order to automatically assign an ASN in paperless, I create ASN cover pages using asn-pdf-generator. However, I did not want this cover page to be a part of the digital document in paperless-ngx.
Run the following commands on the machine (virtual or otherwise) that is hosting paperless-ngx
- Create a folder to save the scripts and virtual environment
mkdir scripts
- cd into scripts directory
cd scripts
- Create a virtual environment
python -m venv venv
- Activate the virtual environment using one of the commands below
source venv/bin/activate
. venv/bin/activate` #remember the dot!
- Install the dependencies
pip install PyPDF2 pyzbar Pillow
- Copy
remove-asn-cover-page.sh
andremove-asn-cover-page.py
to thescripts
directory
- Set the
PAPERLESS_PRE_CONSUME_SCRIPT
to the full path of the bash script. This must be the full path including the script name. Example:/mnt/scripts/remove-asn-cover-page.sh
- Set
PAPERLESS_CONSUMER_ENABLE_BARCODES
to true - Set
PAPERLESS_CONSUMER_ENABLE_ASN_BARCODE
to true