A Scanner generally shoots a beam of light at a printed barcode to detect the width of the bars and the spacing between them.
In particular, a laser scanner detects these parameters by sensing the amount of light being reflected from the surface of the barcode. By contrast, a CCD barcode scanner functions like a digital camera: the scanning element is actually a row of hundreds or thousands of small light sensors, each of them measuring ambient light. The result is effectively taking a picture of the barcode.
A 1D or linear barcode is a series of vertical lines stretched out horizontally, while a 2D barcode is a series of shapes arranged in a matrix, allowing for much more data to be encoded.