TwainSave can take various command line options listed below.
1) If TwainSave is started without command-line options, this is equivalent to the following TwainSave command-line:
twainsave --filetype bmp --filename random-name
where random-name will be a name that has the same format as a Windows Global Unique Identifier (GUID).
For example, if TwainSave is started like this from the command-line:
twainsave
this will create a file in the TwainSave executable directory named similar to:
XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX.bmp
where `X` is a random digit 0-9, or random character a-f.
2) TwainSave uses the default setting for the option if the option is not specified. If TwainSave detects that an illegal command-line option is given, TwainSave will terminate and returns a 5 to the operating system, denoting that an illegal command was used.
3) When producing Acrobat PDF files, TwainSave has various options including setting the producer, keywords, encryption, and other useful PDF options. The options that are PDF specific start named -pdfxxxx where "xxxx" is the option.
In the table below, the TwainSave options can be one or more of the following:
--area
|
Specifies the acquisition area to acquire.
|
--autobright
|
Sets the auto--brightness for the TWAIN device.
|
---autorotate
|
Automatically rotate documents to the correct orientation (must be supported by the TWAIN driver).
|
--autofeed
|
Use the automatic document feeder (default is feeder is not used).
|
--autofeedorflatbed
|
Use the automatic document feeder, and if no paper is detected in feeder, use the flatbed portion of the device (detection of paper in feeder must be supported by the TWAIN driver).
|
--bitsperpixel
|
Bits-per-pixel used to acquire the image.
|
--brightness
|
Brightness level (must be supported by the TWAIN driver).
|
--blankthreshold
|
Sets the threshold (percentage) value for TwainSave to determine if a page is blank. The threshold is the ratio of white pixels to dark pixels on the page. Use this option with -noblankpages
|
--contrast
|
Set the contrast of the image
|
--color
|
Sets the color setting of the device.
|
--deskew
|
Turns on automatic deskewing of images that may be distorted due to skewing.
|
--details
|
Writes to a file all TWAIN device names and color/bits-per-pixel information for each TWAIN device.
|
--diagnose
|
Turn on diagnostic mode.
|
--diagnoselog
|
Log diagnostic messages to the specified file or to the active debug monitor.
|
--dsmsearchorder
|
Sets the order of directories that TwainSave will search to find the TWAIN DSM file (TWAIN_32.DLL or TWAINDSM.DLL)
|
--duplex
|
Use the duplex unit. Default is to not use the duplex unit.
|
--filename
|
File name of the image file. Unless the --details, --version, --uionly or -help option is used, the --filename option is a required command-line option.
|
--filetype
|
File type of the saved image. Default is "bmp". See --filetype for all the various file types.
|
--gamma
|
Gamma value used for the image.
|
--halftone
|
Use a halftone (dithering) pattern for the acquired image file.
|
--help
|
Display TwainSave help.
|
--highlight
|
Highlight value used for the image.
|
--imprinter
|
Use the specified imprinter/endorser.
|
--imprinterstring
|
Sets the imprinter string.
|
--jobcontrol
|
Sets job control options.
|
--language
|
Sets the language to be used for the TWAIN select source dialog, and for diagnostic logs.
|
--jquality
|
Sets the JPEG quality factor for JPEG files.
|
--multipage
|
Save all pages scanned to a multi-page file.
|
--multipage2
|
Save all pages scanned to a multi-page file only when the device user interface is closed.
|
--negate
|
Makes images acquired to be a "negative" of the original image (black or dark colors are light, and white or light colors are dark).
|
--noblankpages
|
Discard any blank pages that have been acquired from the TWAIN device.
|
--noconsole
|
Do not display the console window when running TwainSave.
|
--nopause
|
Do not show the "pause" message when TwainSave is terminated.
|
--noui
|
Do not display the TWAIN device user interface when acquiring pages.
|
--nouiwait
|
Do not display the TWAIN device user interface when acquiring pages and wait for paper to be placed in document feeder to start the acquisition.
|
--nouiwaittime
|
Maximum amount of time to wait for paper to be placed in document feeder before TwainSave shuts down.
|
--numpages
|
Number of pages to acquire. Default is 0 (acquire all pages).
|
--orientation
|
Specifies page orientation when acquiring pages.
|
--overscanmode
|
Sets the device's overscan mode, allowing the device to acquire the part of the page that may lie outside of the acquisition area.
|
--overwritemax
|
Specified the maximum number of unique files to create when
--overwritemode 3 is used.
|
--overwritemode
|
Specifies what action to take if image file(s) already exists.
|
--papersize
|
Paper size. Default is US letter (8.5" x 11").
|
--pdfascii
|
Turns on ASCII compression for PDF files.
|
--pdfauthor
|
Sets the PDF author setting for the file.
|
--pdfcreator
|
Sets the PDF Creator field in PDF files.
|
--pdfencrypt
|
Turns on encryption for PDF file generation.
|
--pdfkeywords
|
Sets the PDF Keywords setting for the file.
|
--pdforient
|
Sets the PDF orientation (landscape or portrait).
|
--pdfownerpass
|
Sets the PDF owner password for encrypted files
|
--pdfpermit
|
Sets the PDF Permissions for an encrypted file.
|
--pdfproducer
|
Sets the PDF Producer field for the PDF file
(deprecated -- please use --pdfcreator).
|
--pdfquality
|
Sets the JPEG quality used in PDF files.
|
--pdfrandowner
|
Sets the PDF owner password to a random string. This permanently disallows changing the security and --pdfpermit settings.
|
--pdfscale
|
Allows scaling of the resulting image when converted to PDF.
|
--pdfsize
|
Sets the size of the PDF page.
|
--pdfsubject
|
Sets the PDF Subject field for the PDF file.
|
--pdftitle
|
Sets the PDF Title field for the PDF file.
|
--pdfuserpass
|
Sets the PDF user password for encrypted files.
|
--pdf128
|
Use 128-bit encryption for PDF files.
|
--resolution
|
Sets the Resolution (DPI) of the acquired image.
|
--rotation
|
Sets the rotation angle of the acquired image.
|
--saveoncancel
|
Save image file even if user cancels scanning.
|
--selectbydialog
|
Select the TWAIN device by using the TWAIN Select Source dialog.
|
--selectbyname
|
Select the TWAIN device by using the name of the device.
|
--selectdefault
|
Select the default TWAIN device.
|
--shadow
|
Sets the Shadow value for the TWAIN device.
|
--showindicator
|
Show progress indicator when using --noui.
|
--tempdir
|
Denotes path where temporary image files will be stored.
|
--threshold
|
Sets the Threshold value for the TWAIN device.
|
--scale
|
Produces thumbnail images.
|
--transparency
|
Use the transparency unit to acquire from films, negatives and slides.
|
--transfermode
|
Sets the transfer mode used to acquire files from the TWAIN device.
|
--unitofmeasure
|
Sets the unit of measure for the device (inch, centimeter, etc.)
|
--uionly
|
Displays the device's user interface, but does not allow scanning or acquiring images. Allows setting device options without scanning pages or acquiring images.
|
--uiperm
|
Allows the TWAIN device's user interface to remain visible after a set of images have been acquired.
|
--usedsm2
|
Use version 2.x of the TWAIN Data Source Manager (TWAINDSM.DLL), if available.
|
--useinc
|
Use the smart auto-incrementing feature when saving multiple pages to multiple files.
|
--verbose
|
Outputs to the screen or file the current action that TwainSave is executing.
|
--verboselog
|
Send --verbose output to a file.
|
--version
|
Displays TwainSave version information.
|
--@
|
Use a command file to specify commands.
|
Here are a few examples of usage:
twainsave --selectdefault --filetype bmp --filename mybmp.bmp
Selects the default device (--selectdefault), saves to BMP format (--filetype bmp), and the name of the file is mybmp.bmp.
twainsave --filetype gif --filename mygif.gif
Displays the TWAIN "Select TWAIN device" dialog to select the device, saves to GIF format (--filetype gif), and the name of the file is mygif.gif.
twainsave --filetype tif3 --color 0 --filename mytifg3.tif --noui
Displays the TWAIN "Select TWAIN device" dialog to select the device (--selectdefault), saves to TIFF Group3 format (--filetype tif3).
The color is set to black and white (--color 0) to ensure that Group 3 format is created correctly (Group 3 must use black and white). No user interface of the TWAIN device is displayed.
twainsave --contrast 20 --filename mybmp.bmp
Acquires to a BMP file and sets the contrast of the image to 20.
twainsave --contrast 20 --filename mybmp.bmp --uiperm
Same as above, except that the TWAIN user interface for the device does not close after a set of pages are acquired (the user must close the user interface).
twainsave --papersize A4 --filename mybmp.bmp
Display the TWAIN "Select TWAIN device" dialog, acquire to a file called mybmp.bmp, and use the A4 paper size. The device must support A4 paper sizes for this option to be successful.
twainsave --selectbyname "Fujitsu Twain Driver" --bitsperpixel 8 --filetype tif7 --filename mytif.tif --noui --duplex
Uses the TWAIN driver named "Fujitsu Twain Driver",
bits-per-pixel is 8
Save to TIFF-LZW format
Name of the file is mytif.tif
Do not display the user interface of the device
Use the duplex unit.
twainsave --verbose
Uses defaults and displays the progress of the acquisition on the screen.
twainsave --@ "mycommands.txt"
Uses the command file called mycommands.txt. This file contains the actual TwainSave commands to use.
twainsave --filename test.bmp
Just specifying the filename does the following defaults:
•
|
Show the TWAIN "Select TWAIN device" window to select the TWAIN driver.
|
•
|
Displays the TWAIN driver's user interface.
|
•
|
Acquires entire page to a Windows BMP file.
|
•
|
The color used is black and white (1 bit per pixel), or the first available color that the TWAIN device supports that is compatble with BMP files.
|
•
|
Closes the TWAIN user-interface displayed after acquiring the image (see the --uiperm option to leave the user interface displayed after an acquistion)
|
Note that some options may cancel out other options. For example, an option to specify the PDFpage size (--pdfsize) will override the --papersize option. Make sure that you choose options that do not conflict with other options in terms of functionality.
Also note that many of these command-line options can be overridden by the user of TwainSave if the TWAIN user interface of the device is displayed (if you do not specify --noui) . For example, if you specify on the command-line to use color (the --color 2 option), and the user changes this by selecting a different color type in the user interface, TwainSave cannot override the user's choices, and will attempt to scan and save the image based on the choices in the user interface.
|