commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
Adjust the --resolution and --mode as required (if these options are available for your scanner).
The size options (-x, -y, -imageheight, -imagewidth) are for US letter paper. For A4, I think the command would be:
scanimage -p --resolution 250 --mode Gray -x 210 -y 297 | pnmtops -imageheight 11.7 -imagewidth 8.3 | ps2pdf - output.pdf
you have to replace "mustek_usb" with the scanner found by `scanimage -l`