dPDFSETTINGS=configurationPresets the "distiller parameters" to one of four predefined settings:
dPDFSETTINGS)| Option | Résolution images | Taille fichier | Usage idéal |
|---|---|---|---|
/screen |
~72 dpi | Très légère | Lecture à l’écran, web |
/ebook |
~150 dpi | Légère | Lecture sur liseuse, PDF interactif |
/printer |
~300 dpi | Moyenne | Impression de bonne qualité |
/prepress |
~300 dpi + profils ICC | Grande | Impression professionnelle (offset) |
/default |
Variable | Variable | Usage général, pas optimisé |
NB Adobe has recently changed the names of the presets it uses in Adobe Acrobat Distiller, in order to avoid confusion with earlier versions we do not plan to change the names of the PDFSETTINGS parameters. The precise value for each control is listed in the table above.
Please be aware that the /prepress setting does not indicate the highest quality conversion. Using any of these presets will involve altering the input, and as such may result in a PDF of poorer quality (compared to the input) than simply using the defaults. The 'best' quality (where best means closest to the original input) is obtained by not setting this parameter at all (or by using /default).
The PDFSETTINGS presets should only be used if you are sure you understand that the output will be altered in a variety of ways from the input. It is usually better to adjust the controls individually (see the table below) if you have a genuine requirement to produce, for example, a PDF file where the images are reduced in resolution.
#!/bin/bash
# Choix du profil de compression
echo "Choisis le profil de compression PDF :"
echo "1) screen (faible qualité, taille minimale)"
echo "2) ebook (moyenne qualité)"
echo "3) printer (bonne qualité impression)"
echo "4) prepress (qualité pro, fichier plus lourd)"
echo "5) default (polyvalent)"
read -p "Entrez le numéro correspondant [1-5] : " choix
case $choix in
1) PDFSETTINGS="/screen" ;;
2) PDFSETTINGS="/ebook" ;;
3) PDFSETTINGS="/printer" ;;
4) PDFSETTINGS="/prepress" ;;
5) PDFSETTINGS="/default" ;;
*) echo "Choix invalide. Sortie."; exit 1 ;;
esac
SUFFIX_PDF="-min.pdf"
# Traitement de chaque fichier PDF passé en argument
for f in "$@"; do
if [[ "$f" == *.pdf ]]; then
base="$(basename "$f" .pdf)"
dir="$(dirname "$f")"
output="$dir/$base$SUFFIX_PDF"
echo "Compression de : $f → $output"
/opt/homebrew/bin/gs -q -dSAFER -dNOPAUSE -dBATCH -sDEVICE=pdfwrite \\
-dPDFSETTINGS="$PDFSETTINGS" \\
-sOutputFile="$output" "$f"
else
echo "Le fichier $f n'est pas un PDF, ignoré."
fi
done
echo "✅ Compression terminée."
SUFFIX_PDF="-min.pdf"
for f in "$@"
do
fichier="$f"
base="$(basename "$fichier" .pdf)"
firstPDF="./"
firstPDF+="$base$SUFFIX_PDF"
/opt/homebrew/bin/gs -q -dSAFER -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dPDFSETTINGS="/screen" \\
-sOutputFile="$firstPDF" "$f"
done
#!/bin/bash
SUFFIX_PDF="-gray.pdf"
for f in "$@"
do
base="$(basename "$f" .pdf)"
firstPDF="$base$SUFFIX_PDF"
outputDir="$(dirname "$f")" # Obtenez le répertoire du fichier source
outputPath="$outputDir/$firstPDF"
$(/opt/homebrew/bin/gs -q -dSAFER -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dPDFSETTINGS="/screen" \\
-sProcessColorModel=DeviceGray \\
-sColorConversionStrategy=Gray \\
-dOverrideICC \\
-sOutputFile="$outputPath" "$f")
# Déplacer le fichier source vers la corbeille
mv "$f" ~/.Trash/
done