Command Overview

Top  Previous  Next

TwainSave can take various command line options.  The only required command-line option is -f (the name of the image file to be saved).  Otherwise, 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, a dialog is displayed that has a summary of all the commands, and the TwainSave program is terminated.

 

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.

 

For some commands, a long version of the command option can be used.  The long version of the command is specified in brackets in the table of commands next to the short version of the command option.  For example, both TwainSave commands are equivalent:

 

twainsave -f test.tif -F tif1

twainsave -filename test.tif -filetype tif1

 

 

In the table below, the TwainSave options can be one or more of the following:

 

-A  [-useautofeed]

Use the automatic document feeder (default is feeder is not used).

 

-AF  [-useautofeedorflatbed]

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).

 

-area

Specifies the acquisition area to acquire.

 

-B  [-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
 

-bpp [-bitsperpixel]

Bits-per-pixel used to acquire the image.

 

-C [-contrast]

Set the contrast of the image

 

-color

Sets the color setting of the device.  

 

-D  [-useduplex]

Use the duplex unit.  Default is to not use the duplex unit.

 

-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.

 

-F  [-filetype]

File type of the saved image.  Default is "bmp".  See -F for all the various file types.

 

-f  [-filename]

File name of the image file.
 
Unless the -details, -version or -help option is used, the -f option is a required command-line option.

 

-G  [-gamma]

Gamma value used for the image.

 

-help

Display TwainSave help.

 

-im  [-imprinterstring]

Sets the imprinter string.

 

-jc  [-jobcontrol]

Sets job control options.

 

-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.
 

-noblankpages

Discard any blank pages that have been acquired from the TWAIN device.
 

-noconsole

Do not open a console window when TwainSave starts up.

 

-noui

Do not display the TWAIN device user interface when acquiring pages.

 

-nopause

Do not pause TwainSave if the file name is missing from the command-line.

 

-orientation

Specifies page orientation when acquiring pages.

 

-p  [-numpages]

Number of pages to acquire.  Default is 0 (acquire all pages).

 

-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.

 

-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.

 

-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.

 

-pdforient

Sets the PDF orientation (landscape or portrait).

 

-pdfscale

Sets the PDF scaling for the PDF file.

 

-pdfsize

Sets the size of the PDF page.

 

-P  [-papersize]

Paper size. Default is US letter (8.5" x 11").

 

-rotation

Sets the rotation angle of the acquired image.

 

-saveoncancel

Save image file even if user cancels scanning.

 

-sd  [-selectdefaultdevice]

Select the default TWAIN device.

 

-sn  [-selectbyname]

Select the TWAIN device by using the name of the device.

 

-tempdir

Denotes path where temporary image files will be stored.
 

-thumbnail

Produces thumbnail images.

 

-trans

Use the transparency unit to acquire from negatives and slides.

 

-U  [-unitofmeasure]

Sets the unit of measure.

 

-uiperm

Allows the TWAIN device's user interface to remain visible after a set of images have been acquired.

 

-useinc

Use the smart auto-incrementing feature when saving multiple pages to multiple files.

 

-v

Outputs the TwainSave version in a message box.

 

-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.
 

-@  [-commandfile]

Use a command file to specify commands.

 

Here are a few examples of usage:

 

twainsave -sd -F bmp -f mybmp.bmp

Selects the default device (-sd), saves to BMP format (-F bmp), and the name of the file is mybmp.bmp.

 

twainsave -F gif -f mygif.gif

Displays the TWAIN "Select TWAIN device" dialog to select the device, saves to GIF format (-F gif), and the name of the file is mygif.gif.

 

twainsave -F tif3 -color 0 -f mytifg3.tif -noui

Displays the TWAIN "Select TWAIN device" dialog to select the device (-sd), saves to TIFF Group3 format (-F 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 -C 20 -f mybmp.bmp

Acquires to a BMP file and sets the contrast of the image to 20.

 

twainsave -C 20 -f 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 -P A4  -f 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 -sn "Fujitsu Twain Driver" -bpp 8 -F tif7 -f mytif.tif -noui -D

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 -f 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)
No verbose output.

 

Note that some options may cancel out other options.  For example, an option to specify the PDFpage size (-pdfsize) will override the -P 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.