Se você não conseguir encontrar uma solução melhor, experimente este script:
#!/bin/bash
# NAME: pdfwalker
# AUTHOR: (c) 2014 Glutanimate <https://github.com/Glutanimate/>
# DESCRIPTION: Invoke one pdf file at a time
# DEPENDENCIES: mupdf
# LICENSE: GNU GPLv3 (http://www.gnu.de/documents/gpl-3.0.en.html)
############# Functions ###############
gui_notify(){
notify-send -i application-pdf "PDF Walker" "$1"
echo "$1"
}
arg_compose_filearray(){
# recursively add pdf files and folders in given arguments to array
unset Files
FileCountCurrent="1"
while IFS= read -r -d $'sudo apt-get install mupdf
' File; do
if [[ ! "$(file -ib "$File")" == *application/pdf* ]]
then
echo "Error: '$File' is not a pdf file. Ignoring."
continue
fi
Files[FileCountCurrent++]="$File"
done < <(find "$@" -type f -name '*.pdf' -print0 | sort -z --version-sort)
FileCountTotal="${#Files[@]}"
}
arg_check(){
if [[ "$FileCountTotal" = "0" ]]; then
gui_notify "ERROR: No PDF files found."
echo "Exiting..."
exit 1
fi
}
############## Checks #################
arg_compose_filearray "$@"
arg_check
################ Main #################
FileCountCurrent="1"
for File in "${Files[@]}"; do
echo "Opening file $FileCountCurrent of $FileCountTotal:"
echo "$File"
mupdf "$File" > /dev/null 2>&1
((FileCountCurrent++))
done
echo "Done."
Instalação
Copie e cole o conteúdo da caixa de código acima em um novo arquivo de texto vazio, salve-o e marque-o como executável através do menu Propriedades do gerenciador de arquivos.
Certifique-se de instalar todas as dependências:
pdfwalker <pdf files or directories>
Uso
pdfwalker "~/Downloads/PDF" "~/Documents/Scans"
Por exemplo:
#!/bin/bash
# NAME: pdfwalker
# AUTHOR: (c) 2014 Glutanimate <https://github.com/Glutanimate/>
# DESCRIPTION: Invoke one pdf file at a time
# DEPENDENCIES: mupdf
# LICENSE: GNU GPLv3 (http://www.gnu.de/documents/gpl-3.0.en.html)
############# Functions ###############
gui_notify(){
notify-send -i application-pdf "PDF Walker" "$1"
echo "$1"
}
arg_compose_filearray(){
# recursively add pdf files and folders in given arguments to array
unset Files
FileCountCurrent="1"
while IFS= read -r -d $'sudo apt-get install mupdf
' File; do
if [[ ! "$(file -ib "$File")" == *application/pdf* ]]
then
echo "Error: '$File' is not a pdf file. Ignoring."
continue
fi
Files[FileCountCurrent++]="$File"
done < <(find "$@" -type f -name '*.pdf' -print0 | sort -z --version-sort)
FileCountTotal="${#Files[@]}"
}
arg_check(){
if [[ "$FileCountTotal" = "0" ]]; then
gui_notify "ERROR: No PDF files found."
echo "Exiting..."
exit 1
fi
}
############## Checks #################
arg_compose_filearray "$@"
arg_check
################ Main #################
FileCountCurrent="1"
for File in "${Files[@]}"; do
echo "Opening file $FileCountCurrent of $FileCountTotal:"
echo "$File"
mupdf "$File" > /dev/null 2>&1
((FileCountCurrent++))
done
echo "Done."
O script localizará recursivamente todos os arquivos PDF nos diretórios selecionados e os abrirá um após o outro com mupdf
. Para mudar para o próximo arquivo em linha, simplesmente feche a janela atual mupdf
( Q ). Se você quiser sair do script completamente, pode terminá-lo do terminal através de CTRL + C .