Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

2 Answers

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 at 13:25
add comment

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.

http://www.nitropdf.com/free-pdf-software

PDFEdit is a good option for linux. read this link to know how to install. cyberciti.biz/tips/open-source-linux-pdf-writer.html

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 at 13:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.