Question: I don't know if this is the right place to ask this question, but...

I need a scanner (paper feed scanner) where depending on either a barcode, or number, or some identifier on the paper being scanned, creates a PDF file with a name based on that identifier.

For example: If I scanned a page with the number 12345 on the top-left of the page, a PDF file named 12345.pdf would be created.

Any suggestions at all would be greatly appreciated!

Answer: 
This works in Linux for the case of a number at the top of the page. You can play with the scan parameters and the pdf conversion parameters to get what you want (compression, etc).

```
#!/bin/bash
# Requires scanimage, tesseract and ImageMagick convert

# Scan the image to temp file. Change command for your scanner
scanimage -d hpaio:/usb/Deskjet_F4100_series?serial=CN7CH4T29D04TJ \
--mode Lineart --resolution 300 --compression None --format=tiff \
> out.tif

# OCR to tmp.txt file
tesseract out.tif tmp

# Extract first line --contains number (thanks Serverfault 66587)
read -r NUMBER < tmp.txt

# Convert image to pdf with the desired name
convert out.tif $NUMBER.pdf

# Clean up
rm out.tif tmp.txt

```

If you prefer bar codes, then you might try processing the image with 
gocr. It will read some types of bar codes. Extracting the resulting 
number is a bit tricky but can be done with a sed filter.
Sorry for answering a 3 year old thread, but I was in search of something like this too in the place I work in. After some research, I stumbled upon [Batch Scan To Pdf](http://www.batchscantopdf.com)  that exactly does what you need in your description. Instead of regular barcodes however, they use QR-Codes. They are SUPER cheap compared to other ones I've seen. Hope this helps others who may need similar functionality.