Zolved community solution Createarticle_iconnew articleEditarticle_iconedit article

How to combine and separate pdf files on Ubuntu

Merging and pulling apart pdf files is easy on Ubuntu

Follow these steps to combine or separate pdf files on Ubuntu.

  • Go to Applications > Accessories > Terminal to open the terminal window.


  • Install pdftk by typing the following commands at the terminal.

    sudo aptitude install pdftk




  • Enter the following commands at the terminal.
    cd
    mkdir bin
    cd bin



  • Edit the pdftk_burst by entering the following command at the terminal.
    gedit pdftk_burst



  • Add the following lines as shown.
    #! /bin/bash
    cd ${1%/*}
    /usr/bin/pdftk "$1" burst
    rm doc_data.txt


    Save and close the file. Edit pdftk_cat by entering the following command at the terminal.

  • gedit pdftk_cat


  • Add the following lines to pdftk_cat

    #!/bin/bash

    cd ${1%/*}

    outfile="00out.pdf"

    if [ -f $outfile ] ; then

        rm -f $outfile

    fi

    /usr/bin/pdftk *.pdf cat output $outfile

       


        Save and close pdftk_cat


  • Change the permissions on the file.

    chmod u+x pdftk_burst pdftk_cat



  • Adding custom command options.

    Select any pdf file and right click on it and go to properties. Go to Open With tab, and click on Add.




  • Click on Use a custom command as shown.


  • Click on browse and select the pdftk_burst file.

       

  •  Click on Add


        

        Repeat the same steps for pdftk_cat also.

      
      
       After pdftk_burst and pdftk_cat are added, click on Close.


      

  • Now when you right click on any pdf file, you will see two new options.

    Open With > pdftk_burst which will convert a 30 page pdf file into 30 different files each containing one page.





  • Now when you right click on any pdf file, you will see two new options.

    Open With > pdftk_cat will combine 30 different files in that folder and joins them and creates one single file called 00out.pdf file.




copyright © 2007, IPTouch, Inc.