NicolasBernaerts / ubuntu-scripts

Various installation & administration scripts for Ubuntu workstation
186 stars 94 forks source link

Feature Request: new file name for pdf-generator #54

Closed Sadi58 closed 4 years ago

Sadi58 commented 4 years ago

Hi, I had a nice and simple Nautilus script which I later used in Nemo file manager of Linux Mint as well, but it doesn't seem to work properly anymore (maybe due to some changes in convert/imagemagick). It doesn't convert text files any longer, and converts office document files very badly (a bad image), which it used to convert to PDF properly but only saving in a subdirectory without including in the PDF file generated (I didn't mind this because I used it only to merge image files to a PDF file). So your script came as a rescue for me - thank you very much! Apart from being very short and simple, the previous script had an additional option to enter new file name for the PDF to be generated, which is missing in your script. I've tried adding this to your script with my very primitive scripting skills, but I couldn't. I'm hoping that you might like to do it. For your information, I copy below the script I've been previously using:

filesall=""
while [ $# -gt 0 ]
do
    lastname="$1"
    files=`echo "$1" | sed 's/ /\?/g'`
    filesall="$filesall $files"
    shift
done
customname=`zenity --entry --title="Merge into PDF" --text="will use last filename or this name:"`
if [ -z "$customname" ]
then
    notify-send "Merge into PDF" "Merging files into one PDF with the same name as the last selected file" -i gtk-dialog-info &
    convert $filesall "$PWD/$lastname.pdf"
else
    notify-send "Merge into PDF" "Merging files into one PDF with the name entered" -i gtk-dialog-info &
    convert $filesall "$PWD/$customname.pdf"
fi
NicolasBernaerts commented 4 years ago

Hi Sadi, PDF conversion using convert is broken since some time. I've written a guide to make it work again : http://www.bernaerts-nicolas.fr/linux/74-ubuntu/358-ubuntu-xenial-bionic-imagemagick-pdf-conversion-error I'm rewriting the script for 20.04. I'll add an option to pass the target file name. It will be --target filename

NicolasBernaerts commented 4 years ago

Hi Sadi, I've updated the script for Ubuntu Focal. It's now taking target filename as parameter.

Sadi58 commented 4 years ago

Thanks! You've changed it quite a bit, even the name, or am I confusing scripts?