#!/bin/bash
rm -f *.tif
FILE=$(echo $1 | sed 's/.tiff//')
echo "TIFF to PDF"
convert "$1" "$1.pdf"
echo "OCR"
ocrmypdf -q -l fra --output-type 'pdfa-2' --pdfa-image-compression jpeg --deskew \
  --author "ALCATEL - scan by museeminitel.fr" \
  --subject "Documentation PAVI E10.5" \
  --keywords "PAVI Videotex Minitel" \
  -j 8 "$1.pdf" "$FILE.pdf"

echo "cleanup"
rm "$1.pdf"
rm -f *.tif
