@BetterRed
Thanks for all your help, this works for me

Great way to achieve what I needed. This should be a wiki entry
This is my script to convert to djvu. It can be run in a folder. It is linux only and you need pdf2djvu package
#!/bin/bash
fltyp()
{
IFS=$'\n'
filename_full="$1"
filename=$(basename "$filename_full" .pdf)
export DIR=$(readlink -f $filename_full)
DIR=${DIR%/*}
echo $DIR
pdf2djvu -j 4 --lossy -v "$2" -o $DIR/$filename.djvu
}
export -f fltyp
find -type f -name "*.pdf" -exec bash -c 'fltyp "{}" "{}"' \;