Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a pdf file with some text on each page which I would like to remove.

The text is matched by a regex and I think it comes in one block of the pdf.

I have used pdfedit to select and delete the text with the GUI but I was looking for a way to do this from the terminal.

share|improve this question

You can try pdftk, but it works only a fraction of the time, due to (I believe) a problem with fonts.

It works like this: first you need to uncompress the pdf file,

  pdftk myfile.pdf output unc.pdf uncompress

then you modify it with

  sed 's/oldstring/newstring/g' < unc.pdf > mod_unc.pdf

lastly you recompress it with

 pdftk mod_unc.pdf output myfile_modified.pdf compress

I have had only moderate success with this command, in the sense that sometimes it works, sometimes it doesn't, according to its whim.

share|improve this answer
I gave it a go but the uncompress turned most of the text to white which never got recovered. Funnily the only text that wasn't white was what I'm trying to get rid of!!! Thanks for the suggestion. – DrYap Feb 1 '14 at 13:25

you can use any PDF editors. Nitro PDF is a good tool to edit PDF. There are also so many free tools. You can add or remove text using this.

PDFEdit is a good option for linux. read this link to know how to install.

share|improve this answer
The OP is on Linux and they said they already used PDFEdit. Please read the question before posting an answer. – slhck Feb 13 '14 at 13:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .