User Tools

Site Tools


linux:linux_hacks

This is an old revision of the document!


Linux hacks

Merge 2 PDFs together from Nautilus http://gnome-look.org/content/show.php/?content=83871 requires pdftk https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/

#!/bin/bash
ifs=$IFS
IFS='\
'
PDFARGUMENTS=""
fpaths=`echo "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | sort`
for file in $fpaths
do
  if [ -f "$file" ]; then
	base=${file%.*}
	ext=${file##*.}
	if [ "$ext" == "pdf" ]; then
	    PDFARGUMENTS="$PDFARGUMENTS \"$file\""
	    pdfdir=`dirname "$file"`
	fi
  fi
done
 
szSavePath=$(zenity --file-selection --save --confirm-overwrite);echo "$szSavePath"
 
if [ -n "$PDFARGUMENTS" ]; then
    eval pdftk "$PDFARGUMENTS" cat output "\"$szSavePath\""
fi
IFS=$ifs
linux/linux_hacks.1416706408.txt.gz · Last modified: 2022/12/29 07:15 (external edit)