Image 01
profile-image

robertoldham

image2pdf

Dolphin Service Menus by DaHoC 21 comments

ImageMagic-6 on Ubuntu 18.04 now does not grant permission to edit PDF files through convert by default. I updated the Exec to check the result of the convert and display an error telling the user that might be the cause if convert fails. Here it is:

Exec=a="'%F'"; namewithoutext="${a%.*}"; namewithextpdf="$namewithoutext.pdf"; count=0; for f in %F; do fdir=$(dirname "$f"); count=`expr $count + 1`; done; cd "$fdir"; newname=$(kdialog --getsavefilename "$fdir" "*.pdf |PDF files"); if [ $? -eq 0 ]; then result=$(convert %F "$newname" 2>&1); if [ $? -eq 0 ]; then kdialog --title "image2pdf" --passivepopup "$count image(s) into single pdf '$newname' converted!"; else kdialog --title "Conversion Failure" --msgbox "The conversion failed, probably because you have not configured permissions for ImageMagic in /etc/ImageMagic-6/policy.xml."; fi; else echo "Aborted"; fi;
- Oct 23 2019