I have a pdf file which contains some three lines of text on the top of every page. Is there any way to remove that 2cm horizontal strip from all pages of this pdf file using any command line tool. I am using ubuntu.
PDFjam should be able to do it. It should be installable on Ubuntu with
sudo apt install pdfjam. Then, move into the directory containing your PDF files and run:
for f in *pdf; do pdfjam --keepinfo --trim "2cm 0mm 0mm 0mm" --clip true --suffix "cropped" "$f"; done
That will create a cropped copy of each pdf file in the directory, where
file-cropped.pdf. If you are satisfied those are correct, you can move them to a new directory (
mv *-cropped.pdf newdir/) and delete the rest.