Sure, but the scanner would have to work as a keyboard wedge so that the decoded scan is input as though it came from a keyboard. Most modern USB scanners work this way.
I was thinking of cell phone with camera or barcode scanner ap
I see. I that case I'd have to say no. In the case of a web form, the browser would have to support that alternate method of data entry. In the case of a PDF form, Adobe Reader for mobile devices does not support such a thing and I'm not aware of any others PDF viewers that do.