Having spent some time with porting scanning application from Delphi 6 to 2009, I want to share with some working twain code. I used very well written component DelphiTwain with some modifications to run in Delphi 2009.

Program sample is attached with library, ready to run. Here is example program screenshot:

Download example here

# Update: Delphi 2010

It was very kind from Gian Mario Benetti side to port this application to Delphi 2010 and add some useful features

  • image rotation clockwise and counterclockwise by 90 degrees
  • moving image with the mouse type PDF
  • function "Save" (which is enabled only if you have made changes to the image) and "save as ..." with preview of files already in the folder (open file with Preview)
  • auto save (with check box to choose to enabled or not) to automatically generate a name and save image in the folder "scan" created in the pathwhere the application is located
  • correct the code that decide whether or not to open the scanner interface (there was an erroneous reference to relative ChecBox)
  • icons to the buttons to embellish the interface
  • disabling buttons while the scanner is active
  • keyboard shortcuts for the most important buttons
Download Delphi 2010 updated code here