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 scan forms at work into PDF files and then use Nitro to make them searchable.

I need to come up with a way to read the 1st 50 characters of the file which is always in the same place in the document, just different text, and rename the file with the information found in those characters.
I then need to save it to directory on our server.

I have been searching for a while and have not found anything that meets this need.
Do you know of any code or programs that will perform this function?

share|improve this question
Would a script be suitable? A python script could open the document, read the text and rename the document. – Paul Oct 1 '11 at 3:42
That was my first thought. Can you recommend some good starter info. I had some experience with VB6 a while back, but don't really know where to start with python. – user99856 Oct 1 '11 at 4:02

There are many ways to do this with a script, but python is a handy versatile language, and works on pretty much any platform.

This is a good starter manual.

And this is a library you can use for reading pdf files. There are a few PDF libraries however.

You may even be able to do this without a pdf library, by reading the file directly.

If you are not recently familiar with script writing, you'll get there quicker with some help, but if you want to try yourself, then the main areas you'd want to focus on are:

  1. Reading command line arguments (so you can pass the filename you want to change)

  2. Opening and reading and closing files

  3. Opening and reading and closing files with the PDF library

  4. String manipulation - substrings and splitting strings may be needed

  5. Using system calls to rename a file

share|improve this answer

You must log in to answer this question.

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