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

1 Answer

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
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.