Converting jpeg to pdf with imagemagick and pdfjoin

Necessary files:

apt-get install pdfjam
apt-get install imagemagick

Script:

Quelle1)

#!/bin/bash
 
tempfiles=""
OUTPUT="jpg2pdf.pdf"
 
function die() {
	echo $*
	exit 1
}
 
for file in $*; do
	ext=${file##*.}
	base=`basename "$file" .$ext`
	pdf="/tmp/$base.pdf"
	echo "$file => $pdf"
	convert -rotate 90 "$file" "$pdf" 
	[ -e $pdf ] || die "Conversion to pdf failed"
	tempfiles="$tempfiles $pdf"
done;
 
pdfjoin $tempfiles --outfile jpg2pdf.pdf
[ -e $OUTPUT ] || die "Join of PDFs failed"
 
rm $tempfiles
 
Nach oben
jpg_to_pdf.txt · Zuletzt geändert: 2024/02/29 13:36 von 127.0.0.1
chimeric.de = chi`s home Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0
DFmW2CEce3htPL1uNQuHUVu4Tk6WXigFQp   Dogecoin Donations Accepted Here    DFmW2CEce3htPL1uNQuHUVu4Tk6WXigFQp  DFmW2CEce3htPL1uNQuHUVu4Tk6WXigFQp