En de nombreuses occasions, vous voudrez peut-être redimensionner un fichier PDF à envoyer par e-mail ou le mettre sur le web.
Pour utiliser Linux vous avez juste besoin du programme à tout faire  ghostscript et avec quelques commandes que vous aurez vos documents redimensionnées.
Par
 exemple, un document de 50Mo prend 15Mo une fois que le PDF redimensionné en conservant une bonne qualité. 
 Première chose, l'installation de ghostscript , pour Ubuntu / Debian et Mint il suffit d'exécuter cette commande : 
 Et maintenant, pour redimensionner votre PDF, vous pouvez utiliser cette commande : 
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen 
 -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf
Remplacez le nom de fichier output.pdf et input.pdf avec vos noms de fichiers. 
 Ce sont les options que vous pouvez utiliser pour sélectionner la qualité de la production: 
-dPDFSETTINGS=/screen   (screen-view-only quality, 72 dpi images)
-dPDFSETTINGS=/ebook    (low quality, 150 dpi images)
-dPDFSETTINGS=/printer  (high quality, 300 dpi images)
-dPDFSETTINGS=/prepress (high quality, color preserving, 300 dpi imgs)
-dPDFSETTINGS=/default  (almost identical to /screen)
ou
sudo apt-get install ghostscript
cd
wget 
http://www.alfredklomp.com/programming/shrinkpdf/shrinkpdf.sh
chmod +x shrinkpdf.sh
exemple :
./shrinkpdf.sh source.pdf destination.pdf
gs -dPDFSETTINGS=/prepress -dSAFER -dCompatibilityLevel=1.5 -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sstdout=%stderr -dGrayImageResolution=600 -dMonoImageResolution=1200 -dColorImageResolution=300 -sOutputFile=vol_iv_gs.pdf -c .setpdfwrite -f vol_iv.pdf
SUR WINDOWS ON UTILISE LA COMMANDE SOUS LA FORME
gswin32 -dPDFSETTINGS=/prepress -dSAFER -dCompatibilityLevel=1.5 -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sstdout=%stderr -dGrayImageResolution=600 -dMonoImageResolution=1200 -dColorImageResolution=300 -sOutputFile=vol_iv_gs.pdf -c .setpdfwrite -f vol_iv.pdf
Pour plusieurs fichiers : 
for file in *.pdf; do output_file=$(echo "$file" | sed -re 's/\.pdf$/out.pdf/'); gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/default -dNOPAUSE -dQUIET -dBATCH -sOutputFile="$output_file" "$file"; done 
 
Linux: How to convert a color pdf to black-white
gs \
  -sOutputFile=sortie_gris.pdf \
  -sDEVICE=pdfwrite \
  -sColorConversionStrategy=Gray \
  -dProcessColorModel=/DeviceGray \
  -dCompatibilityLevel=1.4 \
   source_couleur.pdf
ShrinkPDF
Using ps2pdf
Regrouper des fichiers Jpeg dans un PDF grâce à ImageMagick :
convert *.jpg livret.pdf
Convertir un PDF couleur en niveaux de gris grâce à ImageMagick :
convert -colorspace GRAY input.pdf output.pdf
 
ebook-convert 
eCub
writer2epub pour LibreOffice
Conversion chm vers pdf :
 chm2pdf --book sample.chm sample.pdf
cbr2pdf 
#!/bin/bash
if [ $# -eq 0 ];
then
    echo "Il manque le nom du fichier"
    exit 1
else
    ROOT="/home/user/Bureau/extractPdf"
    outPdf="$ROOT/pdf"
    outText="$ROOT/text"
    outImg="$ROOT/images"
    echo -n "Numéro de la première page : "
    read firstPage
    echo -n "Numéro de la denière page : "
    read lastPage
    echo -n "Masque des fichiers jpg et pdf extrait : "
    read fileNameOut
    
    if [ -z $fileNameOut ];
    then
        echo "Masque de fichier vide"
        exit 1
    else
        echo "+-----------------------+"
        echo "| Extraction des images |"
        pdfimages -f $firstPage -l $lastPage -p  -j $1 $outImg/$fileNameOut
        echo "| Découpage du fichier  |"
        pdfseparate -f $firstPage -l $lastPage $1 $outPdf/$fileNameOut-%d.pdf
        
        echo "| Extraction des textes |"
        echo "+-----------------------+"        
        for FILE in `ls $outPdf`
        do
            pdftotext -raw -nopgbrk $outPdf/$FILE $outText/${FILE%%.*}.txt
            while read ligne
            do
                ligne=`echo $ligne | tr '\r\n' ';'`
                echo -n $ligne >> $outText/$fileNameOut-full.csv
            done < $outText/${FILE%%.*}.txt
            echo "" >> $outText/$fileNameOut-full.csv            
        done        
    fi
fi
exit 0
Conversion PDF en JPG
convert -quality 100 -density 600x600 mondoc.pdf monimage.jpg
   convert METTRE_ICI_LE_NOM_DU_DOCUMENT.pdf output.png
Conversion d'une page de man vers un fichier pdf
man -t convert | ps2pdf - > convert.pdf
man -t imagemagick | ps2pdf - > imagemagick.pdf
 
Extraire des images d'un fichier PDF :
pdftoppm EXEMPLE.pdf labd
Conversion PDF vers CBR avec le scrit PDFtoCBR.sh :
#!/bin/sh
mkdir "`basename \"$1\" .pdf`"
cp "$1" "`basename \"$1\" .pdf`/bd.pdf"
cd "`basename \"$1\" .pdf`"
convert -compress JPEG2000 -quality 75 $f Page.jpg
ls | sed -rn "s/^bd-([0-9]{1})_1\.jpg/mv '&' 'Page-000\1.jpg' /p" |sh
ls | sed -rn "s/^bd-([0-9]{2})_1\.jpg/mv '&' 'Page-00\1.jpg' /p" |sh
ls | sed -rn "s/^bd-([0-9]{3})_1\.jpg/mv '&' 'Page-0\1.jpg' /p" |sh
rar a "../`basename \"$1\" .pdf`.cbr" *; 
cd ..; 
rm -rf "`basename \"$1\" .pdf`"
 
Compiler plusieurs fichiers PDF en un seul fichier :
pkftk *.pdf cat output compil.pdf
 
 
Pdftk the-pdf-toolkit
Pdftk/Ubuntu
Pdftk exemples
Pour 1 rotation à 90° sens horaire :
pdftk original.pdf cat 1-endeast output destination.pdf
Sites pour le PDF :
www.icaunux.org/doku.php?id=logiciels_de_modification_de_pdf
www.zyyne.com/site/ 
www.pdfhacks.com
www.pdftohtml.net
pdfzen.com
www.pdfescape.com
On many occasions, you might want to resize a PDF to send it by 
Email or put it on the web. There are many useless Share- and 
Bloatware-tools (like Adobe Acrobat) that might or might not help you 
with that.
If you happen to work on a Linux, BSD or Mac OSX machine, you can 
simply use ghostscript for the task. It’s much faster and gets better 
filesizes than the Optimize-function of Adobe Acrobat.
All you need to do is to make sure 
ghostscript is installed and then put the following shortcut in your 
.profile or .bashrc in your home-directory.
pdfResize() {
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dNOPAUSE -dQUIET -dBATCH -dPDFSETTINGS=/$1 -sOutputFile=output.pdf $2
}
 
After that’s done, open a new Terminal-window and try the following command:
pdfResize screen MyDocument.pdf
 
You should now find the resized document in a file called 
output.pdf in the same directory.
The first argument sets the quality. Available options are 
screen, 
ebook and 
printer. While 
screen gives you the smalles file size, 
printer provides better quality at a reasonable filesize.
Extraire des images d'un PDF avec imagemagick :
<?php
 exec('/path/to/imagemagick');
?>
Create GIF Thumbnail of First PDF Page
<?php
 //the path to the PDF file
 $strPDF = "my_pdf.pdf";
 exec("convert \"{$strPDF}[0]\" -colorspace RGB -geometry 200 \"output.gif\"");
?>
Create JPEG Thumbnails of ALL Pages Within PDF
<?php
 //the path to the PDF file
 $strPDF = "my_pdf.pdf";
 exec("convert \"{$strPDF}\" -colorspace RGB -geometry 200 \"output.jpg\"");
?>
Create Large PNG 1024px Image of First PDF Page
<?php
 //the path to the PDF file
 $strPDF = "my_pdf.pdf";
 exec("convert \"{$strPDF}[0]\" -colorspace RGB -geometry 1024 \"output.png\"");
?>
Create Large PNG 1024px Images of ALL Pages Within PDF
<?php
 //the path to the PDF file
 $strPDF = "my_pdf.pdf"; 
 exec("convert \"{$strPDF}\" -colorspace RGB -geometry 1024 \"output.png\"");
?>
 
 
Compiler / empaqueter / regrouper plusieurs images dans un fichier PDF :
convert -compress jpeg *.jpg nom_destination.pdf
Autres :
Master PDF Editor
ps2pdf: PostScript-to-PDF converter
K2pdfopt, a PDF/DJVU optimizer for mobile e-readers such as the Kindle
Pour alléger les fichiers ebooks au format .epub :
sudo apt-get install python-beautifulsoup
wget https://raw.githubusercontent.com/rupa/epub/master/epub.py
python epub.py nomeebook.epub
Script python pour les PDF :
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
import shutil  #
'''
This program is Linux only.
Requires pdftops and ps2pdf14
'''
failure = "failure"
filesTo_find = ['pdftops','ps2pdf14']
errorMessage_1 = 'This program requires both pdftops and ps2pdf14.\nOne or both is missing. Please install to allow this program to function'
errorMessage_2 = 'This program does not yet operate on windows.\nFeel free to modify it run on a win32 system'
errorMessage_3 = 'This program does not yet operate on OS2.\nFeel free to modify it run on an OS2 system'
errorMessage_4 = 'You do not have permission to write in this directory.\nCopy the pdf to a writable directory and try again.'
found = 0
try:
    import scribus
except ImportError,err:
    print "This Python script is written for the Scribus scripting interface."
    print "It can only be run from within Scribus."
    sys.exit(1)
if sys.platform != 'win32':
     pass
else:
     result = scribus.messageBox('Sorry - Linux Only program',  errorMessage_2,)
     sys.exit()
if sys.platform != 'os2':
     pass
else:
     result = scribus.messageBox('Sorry - Linux Only program',  errorMessage_3,)
     sys.exit()
path = os.environ['PATH']
paths = path.split(os.pathsep)
for ftf in filesTo_find:
    for p in paths:
        f = p + '/' + ftf
        if os.path.isfile(f):
            found = found + 1    #need to start search for next file when first file found
            break
if found == 2:
    pass
else:
    result = scribus.messageBox('Missing Programs',  errorMessage_1,)
    sys.exit()
homedir = os.path.expanduser("~")
os.chdir(homedir)
filename=scribus.fileDialog("Reduce PDF",  "PDF files(*.PDF *.pdf)")
if os.path.isfile(filename):
  orig_size = os.path.getsize(filename)
  cmd = 'pdftops' + ' ' + filename
  os.system(cmd)
if os.path.exists(filename[:-3] + 'ps'):
  cmd2 = 'ps2pdf14' + ' ' + filename[:-3] + 'ps' + ' ' + filename[:-3] + 'new' + '.pdf'
  os.system(cmd2)
  new_size = os.path.getsize(filename[:-3] + 'new' + '.pdf')
else:
     result = scribus.messageBox('Big Boo Boo',  'Something real bad has gone wrong! Sorry',)
     sys.exit(1)
pdf_file = os.path.basename(filename)
result = scribus.messageBox(pdf_file,"Original size was" + ' ' + str(orig_size) + ' ' + "bytes" + '\n' + "New size is" + ' ' + str(new_size) + ' ' + "bytes"'\n'  )