Linux - work on PDF files via terminal

To reduce a huge PDF 
    gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -sOutputFile=reductedNewFile.pdf hugeOldFile.pdf

To convert to grey scale
 
    convert -colorspace GRAY color.pdf gray.pdfconvert -colorspace GRAY-density 400 -quality 100 color.pdf gray.pdf     convert -colorspace GRAY-density 200 -quality 100 color.pdf gray.pdf     
    convert -colorspace GRAY-density 100 -quality 100 color.pdf gray.pdf

To concatenate jpg in one pdf

     convert *.jpg pictures.pdf    convert -quality 100 -sharpen 0x1.0 *.JPG pdfFile.pdf

To concatenate pdfs in one pdf

     pdftk pdf1.pdf pdf2.pdf pdfN.pdf output newconcatenated.pdf

To split pages
     pdftk myoldfile.pdf cat 1 2 4 5 output mynewfile.pdf

To rotate the first PDF page to 90 degrees clockwise
 
    pdftk in.pdf cat 1east 2-end output out.pdf

Rotate an entire PDF document to 180 degrees
 
    pdftk in.pdf cat 1-endsouth output out.pdf

No comments:

Post a Comment