What is TwainPRO?

TwainPRO™, Version 5 is a windowless control that enables creation of sophisticated TWAIN compliant imaging applications.

The TwainPRO control is designed to communicate with any acquisition device that supplies a standard TWAIN device driver. This includes devices such as flatbed scanners, handheld scanners, and digital cameras.

TwainPRO supports multiple image transfers and is compliant with TWAIN v1.9.

New Features in Version 5

  • Access to device’s capability settings and config dialog
  • Ability to maintain scanner settings for each session
  • JPG, JBIG2, TIFF-G4 compression types added to PDF save
  • TIFF write optimization (faster to write large multi-page TIFFs)
  • TW_STR32 type support

Primary Features Include

  • TWAIN data source selection and image acquisition
  • Option to select data source and acquire image without TWAIN user interface
  • TWAIN capability negotiation for all TWAIN Version 1.9 capabilities
  • File export including: TIFF, Bitmap, JPEG, PIC and PDF (encoded as TIFF, JBIG2, SequentialJPEG)
  • FTP transfer of file exports
See Also

Getting Support and Samples | License Agreement | Operating Requirements

© 2008, Pegasus Imaging Corporation, All Rights Reserved.


What is The ImagXpress Product Family?

ImagXpress® Version 9 is Pegasus Imaging Corporation’s comprehensive image processing toolkit designed for document imaging, medical imaging, and photo imaging application development. The ImagXpress v9 Product Family includes the following Components:

  • ImagXpress v9 – image compression, decompression, viewing, and processing
  • NotateXpress™ v9 – image annotation support
  • ThumbnailXpress™ v2 – thumbnail image support
  • TwainPRO™ v5 – TWAIN image acquisition support
  • PrintPRO™ v4 – image printing support

ImagXpress Editions: The components within the ImagXpress v9 Product Family are available in four editions, designed to meet specific imaging needs:

  • Photo: includes ImagXpress, NotateXpress, TwainPRO, PrintPRO, and ThumbnailXpress
  • Document: includes ImagXpress, NotateXpress, TwainPRO, PrintPRO, and ThumbnailXpress
  • View: Includes ImagXpress, NotateXpress, PrintPRO, and ThumbnailXpress
  • Standard: Includes ImagXpress and TwainPRO

Additional Pegasus Imaging Components: Additional components are available for purchase separately, and integrate easily with to provide a comprehensive imaging solution:

  • PDFXpress™ – PDF creation, viewing, and annotating
  • OCRXpress™ – full page OCR
  • Barcode Xpress™ – recognize barcodes
  • ScanFix Xpress™ – advanced image cleanup
  • FormFix™ – form ID, dropout, and OMR
  • SmartZone™ ICR / OCR – character recognition

See www.PegasusImaging.com for product packaging and sales information.

See Also

Getting Support and Samples | License Agreement | Operating Requirements


Getting Support and Samples

Benefits of Registering your Pegasus Development Kit

Purchasers of development kits need to register with Pegasus in order to be notified of updates and receive support now or in the future. Registration is automatic when purchased directly from the Pegasus web site. If purchased through a Pegasus re-seller, please register your purchase by filling out the form at www.PegasusImaging.com/registration.htm.

Vehicles for Support

Samples

Samples are included in the downloaded installation.

The product installation program installs a common sample folder accessible via the Start Menu.

Samples for the .NET framework:

  • Microsoft VisualBasic.Net
  • Microsoft C#

Access the Samples

  • Through the Windows Start menu: Start | Programs | Pegasus Imaging | TwainPRO | Samples
  • Sample image files included

Sample Code Newsgroups

Customers create samples of great benefit to other developers, so we created a Sample Code Newsgroup. This is a newsgroup for our customers and potential customers. They post and receive sample code from our development team and other developers to expedite their development. Go online at: www.PegasusImaging.com/samplecode.htm

Web Support

Visit the Pegasus Imaging web site frequently asked questions page www.PegasusImaging.com/faq.htm for the fastest answers to common questions. The web site also provides other support options that are accessible at www.PegasusImaging.com/supportagree.htm.

E-mail Support

Both pre-sale and post-sale e-mail support is offered free of charge. Questions are answered on a First-Come-First-Served basis. Support@JPG.com responds instantly to e-mail received with a helpful set of locations to find additional information on Pegasus products including FAQ's, sample code, newsgroup locations and other current information pertaining to the use of the products. The support request is then added to the queue of outstanding requests. The goal of the support team to respond to each e-mail within 1 business day.

The sales team is always available as a backup to the support team. If you feel you have an urgent support or sales issue please contact Sales@JPG.com . They will assist you promptly.

Newsgroup Support

The Publicly accessible NNTP news groups located at News.PegasusImaging.com are available for each of the Controls as well as advanced imaging technology and a sample code group. We expect that the development community will freely access and search these newsgroups to find common questions and answers regarding specific uses of the controls.

On-Demand Phone Support

On-demand priority phone support can be purchased in 15 minute increments with a credit card via the Pegasus Imaging Corporation web site Support, General Info page. If you decide to purchase "on-demand" phone support, instructions will immediately be e-mailed upon receipt of your purchase.

Additionally, Pegasus offers three support plans for those customers whose commercial products or projects are sensitive or critical in nature, where immediate response and 'latest release' code are important.

1. Chariot Support

All Pegasus Imaging customers are given the opportunity to purchase a Chariot Support agreement. This is a maintenance and upgrade agreement that entitles customers to priority e-mail service, direct phone support from the support and development staff and free product upgrades for the covered products. Since upgrades are included for Chariot customers at no additional charge, Chariot customers can frequently save money, plus obtain the benefits of phone and expedited support. Pegasus Imaging reserves the right to change the terms of this service at any renewal period. Contact Sales via the web at www.PegasusImaging.com/contactform.htm for more information.

2. Galleon Support

Customers are given the opportunity to purchase Galleon Support for Pegasus Imaging products that are applications and for products that require Run Time licensing. Galleon Support includes licensing of product upgrades for deployed installations at no additional license fee cost.Pegasus Imaging reserves the right to change the terms of this service at any renewal period. Contact Sales via the web at www.PegasusImaging.com/contactform.htm for more information.

3. Atlas Support

All Pegasus Imaging customers are given the opportunity to purchase an Atlas Support agreement on currently supported products. This is an agreement that entitles customers to priority e-mail service and direct phone support from the support and development staff. It differs from Chariot Support in that it does not include version upgrades free of charge. Pegasus Imaging reserves the right to change the terms of this service at any renewal period. Contact Sales via the web at www.PegasusImaging.com/contactform.htm for more information.

For the latest and most up-to-date support information, access www.PegasusImaging.com/contact.htm.

See Also

Operating Requirements | Trial Mode | Installing on a Development Machine


Pegasus Imaging Corporation

Pegasus Imaging is uniquely positioned to serve as your leading imaging technology supplier. A full suite of document imaging toolkits, forms processing technology, medical image compression SDKs, photo editing and compression libraries, browser-based image viewers, and video codecs provide advanced technology designed to enhance imaging software solutions. Fully functional trial downloads and customer-acclaimed support allow you to be certain your requirements will be met before purchase. Work with the best. Choose Pegasus Imaging for all your imaging needs.

Visit www.PegasusImaging.com for full product descriptions, FAQ's, downloads, demos, and contact information.

Pegasus Imaging

4001 North Riverside Drive

Tampa, FL 33603

Sales: 813-875-7575

Copyrights & Trademarks

Pegasus and the Pegasus Horse Logo are registered marks (®) of Pegasus Imaging Corporation.

Barcode Xpress, CapturePRO, FilePrinter, FormAssist, FormDirector, FormSuite, ISIS Xpress, The JPEG Wizard, MedXpress, NotateXpress, BarcodeXpress, PDF Xpress, PICTools, ePIC, PICVideo, PrintPRO, SmartScan Xpress, SmartZone, ThumbnailXpress, and TwainPRO are trademarks (™) of Pegasus Imaging Corporation.

ImagXpress, FormFix, ScanFix, Prizm, ColorDrop, ColorEnhance, ColorFind, ColorForms, CompressDirector, Digital Mark Recognition (DMR), Image Detergent, ViewDirector and Virtual Scoring Center (VSC) by assignment are trademarks (™) or registered trademarks (®) of Pegasus Imaging Corporation.

Pegasus Imaging and/or its agents use these marks and brand names in connection with its goods and/or services, in the United States and other countries. Information in this document is subject to change without notice. No part of this document may be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose, without the express written permission of Pegasus Imaging Corporation.

Microsoft, Microsoft.NET, Visual Basic, Visual Studio and Visual Studio.NET are trademarks of Microsoft Corporation in the USA and/or other countries. All other product and brand names are the property of their respective owners.


Operating Requirements

Operating Systems

TwainPRO™ runs on 32-bit Microsoft Windows operating systems: Vista, 2000 Professional and Server, XP Home and Professional, Server 2003 and Windows Server 2008. It works with 32-bit Windows versions running on 32 and 64-bit processors. It runs in 32-bit executables running under 64-bit Windows 2000 Server, 2003 Server, and Windows Server 2008.

Threading

Pegasus considers thread-safe to be when an application using this component can use multiple controls running in the same process, where they don't interfere with each other. The thread creating the control owns the control and is the only thread that can interact with it.

Development Environment

Microsoft Visual Basic 6

Microsoft Visual C++ 6

Delphi 7 and 8

Caching Data and Memory Usage

During normal operation TwainPRO caches data to temporary files on the hard drive. The size of the image and the amount of text on an image dictate how much hard drive space each page uses. Each page added to a document also increases the amount of hard drive space needed. To ensure effective operation, there should be 7 to 8 MB of hard drive space for each 8 1/2 by 11 inch 300dpi 24bpp page of full text at 12pt font size.

See Also

Getting Support and Samples | Installing on a Development Machine | Run Time Licensing


Installing on a Development Machine

To Install TwainPRO™ Component

Run the downloaded setup program which installs the development kit on your development machine.

The downloaded development kit includes code samples for supported platforms. Samples are available through the Start | Programs | Pegasus Imaging | TwainPRO v5.0 menu.

By default this will register trial licensing which allows you to develop applications but not to distribute them. The trial license allows testing of all the functions and features.

Please see the section 'Distributing Applications and Deployment' to understand the limits and details to convert licensing editions.
In order to distribute your finished application you must purchase and install a fully paid license from Pegasus Imaging Corporation. The paid licenses override trial licenses.

To Use TwainPRO Help Files

Stand-alone Help file "PegasusImaging.ActiveX.TwainPro5.chm"

Access the TwainPRO stand-alone help through the Windows Start menu: Start | Programs | Pegasus Imaging | TwainPRO v5.0

The stand-alone file is created with MS Help system version 1. To view stand-alone help files, you must have:

  • Windows 2000 or higher (to view the file via the Windows HTML Help Viewer)
  • Internet Explorer 6.0 or higher
  • MS HTML Help Viewer

See Also

Operating Requirements | Run Time Licensing | Development Mode | License Agreement | Distributing with Your ActiveX Application


Import TwainPRO as a COM Object

TwainPRO™ can be used as an ActiveX control in development environments that provide container support including Visual Basic or Visual C++. In these environments, place a TwainPRO control on a form or dialog box.

You can also import TwainPRO as a COM object in development environments such as Visual C++ or C++ Builder. In this case, TwainPRO is not restricted to a dialog box and it does not require container support.

In C++ Builder versions 4 or 5, to import TwainPRO is to Import the TwainPRO5.dll Type Library. Importing the TwainPRO type library produces 2 files: TwnPRO5lib_tlb.cpp and TwnPRO5lib_tlb.h. These 2 files are normally placed in Builder’s Imports directory. You will include TwnPRO5lib_tlb.cpp in your application: "#include <TwnPRO5lib_tlb.cpp>". Make sure that the Builder Imports directory is added to your ‘Includes’ directory search.

Starting with version 5 of Visual C++, Microsoft has provides support for a new #import compiler directive that enables developers to import components directly as native COM objects, bypassing the ActiveX wrapping.

TwainPRO provides the dual interface necessary to import a component as a COM object. The following technique illustrates how to use TwainPRO as an imported COM object in Visual C++. References will be made to files in the TwainPRO Visual C++ sample, twnpro.dsw, and the pertinent statements are shown in boldface.

Importing a Control into Visual C++

The #import directive line can be added to the stdafx.h file to provide the appropriate functionality to all source files in the project.

C++ Example:

// This code demonstrates the #import directive used in the stdafx.h file

// stdafx.h : include file for standard system include files,

// or project specific include files that are used frequently,

// but are changed infrequently.

#if !defined(AFX_STDAFX_H__B3B1744A_3620_11D3_BF3E_INCLUDED_)

#define AFX_STDAFX_H__B3B1744A_3620_11D3_BF3E_INCLUDED_

#if _MSC_VER >= 1000

#pragma once

#endif // _MSC_VER >= 1000

#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers

#include <afxwin.h> // MFC core and standard components

#include <afxext.h> // MFC extensions

#include <afxdisp.h> // MFC OLE automation classes

#ifndef _AFX_NO_AFXCMN_SUPPORT

#include <afxcmn.h> // MFC support for Windows Common Controls

#endif // _AFX_NO_AFXCMN_SUPPORT

#import "c:\windows\system\twainpro5.dll"

//{{AFX_INSERT_LOCATION}}

// Microsoft Developer Studio will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_STDAFX_H__B3B1744A_3620_11D3_BF3E_INCLUDED_)

The #import directive points to the TwainPRO control. When you #import the TwainPRO control, the compiler produces 2 files – a .tli and a .tlh file – that together create the necessary COM wrapper for the control’s properties and methods. Since the directive is in your stdafx.h file, the wrappers are immediately available to your other modules. The wrapper code defines COM smart pointers to your .IDL-defined interfaces. To use this COM object, create an instance of the interface you want and then call methods directly off this instance pointer.

Declare a Pointer to the COM Object

After you add the #import statement, you need to define a pointer to the TwainPRO COM object and its event handlers. We have implemented the event handling interface for you. This interface is located in TwainPRO5Events.h which is installed in the TwainPRO VCCom\Include directory. This file introduces the CTwainPRO class which encapsulates both the COM pointer and the event handler interface, therefore, you must always include this file. In the TwainPRO project, the pointer is called pTwainPRO and the encapsulated class is called ppCTwainPRO. They are implemented in the TwnPRODlg.h file as follows:

C++ Example:

// This code demonstrates how the pointer is declared and implemented in the TwnPRODlg.h file

#if !defined(AFX_TWNPRODLG_H__B3B17448_3620_11D3_BF3E_INCLUDED_)

#define AFX_TWNPRODLG_H__B3B17448_3620_11D3_BF3E_INCLUDED_

#if _MSC_VER >= 1000

#pragma once

#endif // _MSC_VER >= 1000

using namespace TWNPRO5Lib;

#include "TwainPRO5Events.h"

/////////////////////////////////////////////////////////////////////////////

// CTwnPRODlg dialog

class CTwnPRODlg : public CDialog, CTwnPROEventHandler

{

// Construction

public:

CTwnPRODlg(CWnd* pParent = NULL); // standard constructor

// this will be the pointer to our COM instance

CTwainPRO *ppCTwainPRO;

ITwainPROPtr pTwainPRO;

Initialize COM

You need to initialize the COM library before you can call COM functions. Also, you need to close the COM library and delete the TwainPRO COM object when your program ends. This is illustrated in the TwnPRO.cpp file as follows:

C++ Example:
// This code demonstrates how the COM library must be initialized

// Initialize the COM library on the current apartment and

// identify the currency model as single-thread apartment (STA).

// Applications must initialize the COM library before they

// can call COM library functions other than CoGetMalloc and

// memory allocation functions.

CoInitialize(NULL);

AfxEnableControlContainer();

// Standard initialization

// If you are not using these features and wish to reduce the size

// of your final executable, you should remove from the following

// the specific initialization routines you do not need.

#ifdef _AFXDLL

Enable3dControls(); // Call this when using MFC in a shared DLL

#else

Enable3dControlsStatic(); // Call this when linking to MFC statically

#endif

CTwnPRODlg dlg;

m_pMainWnd = &dlg;

int nResponse = dlg.DoModal();

if (nResponse == IDOK)

{

// TODO: Place code here to handle when the dialog is

// dismissed with OK

}

else if (nResponse == IDCANCEL)

{

// TODO: Place code here to handle when the dialog is

// dismissed with Cancel

}

// Closes the COM library on the current apartment,

// unloads all DLLs loaded by apartment,

// frees any other resources that the apartment maintains, and

// forces all RPC connections on the apartment to close.

CoUninitialize();

// Since the dialog has been closed, return FALSE so that we exit the

// application, rather than start the application's message pump.

return FALSE;

Create the TwainPRO COM Object

You need to create an instance of the TwainPRO COM object. In the TwnPRO project, the COM object is created in the OnInitDialog function in the TwnPRODlg.cpp file. After creating the object, the first thing that must be done is to set the hParentWnd property. This tells the TwainPRO object what window to use as a parent. If this property is not set, the Twain device will not function correctly. Normally, this is handled by the container, but when #importing a control, there is no container. If you want to handle events fired from the TwainPRO object, you will have to create a sink. This is also done in the OnInitDialog function. The relevant portions of the OnInitDialog are as follows:

C++ Example:
// This code demonstrates how the TwainPRO COM object is created

#include "tp4_open.cpp"

BOOL CTwnPRODlg::OnInitDialog()

{

CDialog::OnInitDialog();

// Open TwainPRO Initialization

HINSTANCE hDLL = TP_Open();

// Set the icon for this dialog. The framework does

// this automatically when the application's main window

// is not a dialog

SetIcon(m_hIcon, TRUE); // Set big icon

SetIcon(m_hIcon, FALSE); // Set small icon

// Create a TwainPRO object

ppCTwainPRO = new CTwainPRO((DWORD)this, 1);

pTwainPRO = ppCTwainPRO->pTwainPRO;

// Set the application window handle to TwainPRO.

// This property was added specifically for creating

// TwainPRO in-proc and the control will not work

// unless this property is set with the application's

// window handle.

pTwainPRO->hParentWnd = (long)m_hWnd;

// Set up the PostScan event Handler

ppCTwainPRO->SetPostScanEvent(PostScan);

// Must close the initialization AFTER the first

// instance of the TwainPRO control is created

TP_Close(hDLL);

return TRUE; // return TRUE unless you set the focus to a control

}

// Create an in-proc instance of the COM object inside our ActiveX

The tp4_open.cpp file is installed in the TwainPRO VCCom\Include directory. This file contains 2 functions TP_Open and TP_Close. These function calls are required to properly register and license the TwainPRO COM object and only need to be called once. You must issue a TP_Open prior to creating the first TwainPRO object and you must issue a TP_Close anytime after the first TwainPRO object is created.

When creating a new TwainPRO object, you must pass the following parameters:

DWORD classPtr

DWORD objID - A unique object ID that you assign to the object’s instance. This ID can be used in event handling to determine which instance of an object has triggered the event.

Using the TwainPRO COM Object to Set Properties and Call Methods

After an instance of the TwainPRO COM object is created, the object can be used to set TwainPRO properties and call TwainPRO methods.

C++ Example:
// This code demonstrates the property used to show the scanner's user interface and the method used to start a TWAIN session
pTwainPRO->ShowUI = true;
pTwainPRO->StartSession();

Deleting the TwainPRO COM Object

The TwainPRO COM object must be deleted when it is no longer needed. The object is usually deleted before the application exits. In the TwainPRO sample, this is done in the OnDestroy message handler as follows:

C++ Example:
// This code demonstrates how to delete the TwainPRO COM object

void CTwnPRODlg::OnDestroy()

{

CDialog::OnDestroy();

pTwainPRO = NULL;

if (ppCTwainPRO)

{

delete ppCTwainPRO;

}

}


Handling Events with the TwainPRO COM Object

The TwainPRO™ sample demonstrates how to handle events with the TwainPRO COM object.

The Event handler prototypes are located in TwainPRO5Events.h in the private section of the CTwainPRO class. The Event handler parameters contain a DWORD instance pointer and a DWORD object ID followed by the same parameter list as the corresponding ActiveX event.

The following tutorial demonstrates adding a PostScan event to the TwainPRO sample.

1. Add the Event Handler Prototype to TwnPRODlg.h

C++ Example:

// This code demonstrates how to use the static keyword when defining the event handler

class CTwnPRODlg : public CDialog

{

static HRESULT PostScan(DWORD instancePtr, DWORD objID, VARIANT_BOOL Cancel);

2. After Creating the Objects in TwnPRODlg.cpp, Set the PostScan Event to the Function Name PostScan

C++ Example:

// This code demonstrates how to create a TwainPRO object

ppCTwainPRO = new CTwainPRO((DWORD)this, 1);

pTwainPRO = ppCTwainPRO->pTwainPRO;

// Set the application window handle to TwainPRO.

// This property was added specifically for creating

// TwainPRO in-proc and the control will not work

// unless this property is set with the application's

// window handle.

pTwainPRO->PuthParentWnd((long) m_hWnd);

// Set up the PostScan event handler

ppCTwainPRO->SetPostScanEvent(PostScan);

3. Implement the Event Handler

The first line in the event handler typecasts the instance pointer to a CTwnPRODlg class pointer in order to gain access to the objects on the dialog.

The Object ID is the object ID that is passed as the second parameter when a new TwainPRO object is created. If there are multiple TwainPRO objects, use the Object ID to determine which object generated the event.

C++ Example:

// This code demonstrates how to implement an event handler

HRESULT CTwnPRODlg::PostScan

(

DWORD instancePtr,

DWORD ObjID,

VARIANT_BOOL Cancel

)

{

CTwnPRODlg *p = (CTwnPRODlg *) instancePtr;

char buf[_MAX_PATH];

p->GetDlgItemText(IDC_FILENAME, buf, _MAX_PATH);

p->pTwainPRO->SaveFile(buf);

return S_OK;

}

See Also

PostScan Event


Use TwainPRO as an ActiveX Control

TwainPRO™ can be used as an ATL COM ActiveX control in development environments, like Visual Basic, that accept ActiveX controls. The following discussion assumes that your development environment is Visual Basic.

Creating an Application with Visual Basic and TwainPRO

  1. Add the TwainPRO control to a project.
  2. Use the TwainPRO control on a form.
  3. Write code that controls the TwainPRO properties and methods.

Loading the TwainPRO Control Involves Adding it to a Project

  1. Open the project that will use the TwainPRO control. This can be a new or existing project.
  2. From the Project menu, choose Components. The Control window appears with a list of available controls.
  3. Select the Pegasus Imaging control (i.e. TwainPRO). Click the OK button.

Other Environments

The TwainPRO control is supported by a variety of host environments. To use TwainPRO in other environments, consult the development tool's documentation for information on how to use ActiveX controls. As soon as the control is loaded, the following things happen:

  1. The control becomes part of the current project.
  2. A new tool is added to the Toolbox. This tool is used to draw the TwainPRO control on the form.
The new control can now be used as if it were a standard control. The TwainPRO control has its own set of properties and methods which can be seen by using the Properties and Code windows.


Trial Mode

Default Installation

The default installation installs Trial Mode licensing. This allows you to test features and functions and develop applications but not distribute them. Installing TwainPRO™ in trial mode provides you with access to all features and functionality of the TwainPRO product. E-mail support is available with the trial license.

When using the trial version of TwainPRO, an evaluation dialog box displays periodically.

Applications built with a trial license can only be run on a computer that has TwainPRO Licensing installed on it.

Changing Trial Mode Behavior

You have the flexibility to change the behavior of TwainPRO in evaluation mode as follows:

  • To facilitate server/service mode evaluations, you can choose to halt the component processing after 5 minutes in lieu of displaying an evaluation dialog box periodically. This is accomplished by setting the EvaluationMode property to TP_EvaluationModeTimeout.
See Also

Development Mode | Run Time Licensing | License Agreement | Getting Support and Samples


Development Mode

To suppress the evaluation dialog box and deploy your application, or attain technical support (beyond e-mail), as well as future product updates and upgrade notifications, you must update from a trial version to a paid version of the TwainPRO™ v5 development kit.

1. Purchase Development Kit(s)

To purchase licensing of the TwainPRO development kit, use one of the following options:

  • Purchase online at www.PegasusImaging.com.
  • Contact Sales via the web at www.PegasusImaging.com/contactform.htm.
  • Contact a Pegasus Imaging Corporation reseller.

When the development kit is purchased, we e-mail a serial number & registration code to you. You need these codes to upgrade from trial to paid licensing.

2. Register the TwainPRO Product

When you purchase TwainPRO online or via Sales at www.PegasusImaging.com/contactform.htm, your product ownership is automatically registered.

To register products purchased through a reseller, use the form found at www.PegasusImaging.com/registration.htm.

See Getting Support and Samples for a discussion of benefits to providing your name to Pegasus Imaging. We never sell our customer information.

If your registration information should change, visit www.PegasusImaging.com/contact.htm for forms to update registration information.

3. Update Your TwainPRO Product Version from Trial to Paid Licensing

Updating your TwainPRO from trial to paid licensing will suppress the trial behavior, including the evaluation dialog box or timeout.

To update components from trial to paid licensing:

  • Enter your new license codes using one of the following options:
    • Enter licensing information (serial number, registration code and personal registration information) during component installation while downloading the latest release from www.PegasusImaging.com (the recommended approach).
    • Alternatively, licensing information (serial number, registration code and personal registration information) can be entered through the Visual Development Environment in response to the dialog display.

For more information on Run Time licensing, see the www.PegasusImaging.com for more detailed information regarding Run Times and Deployment Licensing.

See Also

Trial Mode | Run Time Licensing | License Agreement | Getting Support and Samples


Run Time Licensing

Run Time & Deployment Licensing

All copyrights to Pegasus Imaging development kits and software are retained by Pegasus Imaging Corporation. ALL RIGHTS RESERVED. Your use of any of Pegasus Imaging software or run-times created with Pegasus Imaging software is allowed under license terms granted by Pegasus Imaging. It is the Licensee's responsibility to honor the terms of such license grants.

Locking Mechanism

TwainPRO™ contains a locking mechanism that does not permit you to distribute applications created with evaluation versions of TwainPRO. Prior to distributing an application that utilizes TwainPRO, you must purchase and enable run-time licensing. If the application will be delivered on the web, you must also purchase and enable web application licensing.

Obtaining Appropriate Licensing

The Licensee is required to purchase one copy of our development kit(s) for each developer in addition to obtaining the appropriate license agreement prior to deploying applications which contain Pegasus code.

Pegasus Imaging software applications and development tools are limited for use on a single CPU. Any runtimes or copies created must be granted by a direct license from Pegasus Imaging Corporation. These "end user" licenses provide the terms and limits of number and usage.

All prospective customers have every opportunity to evaluate Pegasus Imaging's products prior to purchasing. Product licensing is priced to cover what is considered to be normal (and even high) use. In addition, Pegasus Imaging fully supports and warrants its code and pricing reflects those costs as well. The larger and more valuable an application deployment is, the higher the support and warranty risk is for Pegasus.

Review the licensing categories, and select the one that matches your deployment. Special circumstances should be discussed with a Pegasus Imaging representative.

For more information on Run Time licensing, see the Pegasus Imaging website for more detailed information regarding Run Times and Deployment Licensing.

See Also

www.PegasusImaging.com | Getting Support and Samples | Development Mode | License Agreement | Distributing with Your ActiveX Application


License Agreement

Pegasus Imaging Corporation

SOFTWARE LICENSE AGREEMENT

GRANT OF LICENSE

This Pegasus Imaging Corporation ("PEGASUS") Agreement ("License") permits Licensee ("LICENSEE") the right to use one copy of a properly registered Pegasus Development Toolkit ("TOOLKIT") for development purposes on any single computer, provided the TOOLKIT is in use on only one computer at any time. TOOLKIT is "in-use" on a computer when it loads into temporary memory (that is, RAM) or installed into the permanent memory (that is, hard disk, CD-ROM, or other storage device) of that computer.

REDISTRIBUTION OF THE TOOLKIT RUNTIMES

PEGASUS does NOT grant any Run Time licenses with the TOOLKIT purchase, except by specific exemptions described on our licensing web pages. For Run Time Licensing information, please visit our web site (www.PegasusImaging.com/licensing.htm), or contact our sales staff. Any rights to distribute TOOLKIT run times as part of the LICENSEE's software application or derivative works ("PRODUCT"), require you to acknowledge and uphold this License Agreement and agree to notify PEGASUS immediately of any changes in status or violations. In cases where PEGASUS grants the LICENSEE a right to use, reproduce, display or otherwise distribute or transfer copies of TOOLKIT run times, LICENSEE agrees and affirms the following:

a) LICENSEE is not using PEGASUS' name, logo, or trademarks to market PRODUCT without prior written approval of PEGASUS.

b) LICENSEE agrees to indemnify, hold harmless and defend PEGASUS from and against any claims or lawsuits, including attorney's fees, that arise or result from the use or distribution of PRODUCT.

c) Only the TOOLKIT run times can be distributed. Distribution of the TOOLKIT development kit, documentation, source code, or the distribution unlock codes, is a violation of this agreement.

d) LICENSEE includes a statement substantially similar to the following within derivative work's documentation and about box: "This product contains portions of imaging code owned by Pegasus Imaging Corporation, Tampa, FL, (www.PegasusImaging.com). ALL RIGHTS RESERVED."

If ANY of the above terms are not applicable to LICENSEE'S situation, or any of the above cannot be complied with, or LICENSEE needs modifications to this license, for any reason; then LICENSEE shall obtain an expanded direct license from PEGASUS for derivative works, (available by phone at: 813-875-7575, x321, by e-mail at: Sales@jpg.com.

PEGASUS reserves the right to charge the LICENSEE up to ten times the normal license price for the use of each unlicensed copy of PRODUCT. The license granted herein and all of your rights to use or maintain possession of TOOLKIT shall terminate immediately upon breach of any material provisions of this Agreement.

This license grants rights to LICENSEE for only the PEGASUS code (TOOLKIT) mentioned above and does not convey any other rights of use or distribution to PEGASUS technology.

COPYRIGHT

The Software is owned by PEGASUS or Pegasus Imaging Corporation and is protected by United States copyright laws and international treaty provisions. LICENSEE may not remove or alter the copyright notice from any copy of the Software or any copy of the written materials, accompanying the Software.

OTHER RESTRICTIONS

This PEGASUS License Agreement is LICENSEE's proof of license to exercise the rights granted herein and must be retained by LICENSEE. LICENSEE may not rent, lease or transfer TOOLKIT or parts thereof. LICENSEE may not reverse engineer, decompile or disassemble TOOLKIT.

NO WARRANTY

ANY USE BY LICENSEE OF THE SOFTWARE IS AT THE LICENSEE'S OWN RISK. THE SOFTWARE IS PROVIDED FOR USE ONLY WITH WINDOWS PRODUCTS AND RELATED APPLICATION SOFTWARE AND/OR HARDWARE PRODUCTS. THE SOFTWARE IS PROVIDED FOR USE "AS IS" WITHOUT WARRANTY OF ANY KIND. TO THE MAXIMUM EXTENT PERMITTED BY LAW, PEGASUS DISCLAIMS ALL WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. PEGASUS IS NOT OBVLIGATED TO PROVIDE ANY UPDATES TO THE SOFTWARE.

NO LIABILITY FOR CONSEQUENTIAL DAMAGES

In no event shall PEGASUS be liable for any damages whatsoever (including, without limitation, incidental, direct, indirect and consequential damages, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use or inability to use this PEGASUS product, even if PEGASUS has been advised of the possibility of such damages. Because some states/countries do not allow the exclusion or limitation of liability for consequential or incidental damages, the above limitation may not apply to LICENSEE.

INDEMNIFICATION BY LICENSEE

If LICENSEE distributes TOOLKIT in violation of this Agreement, LICENSEE agrees to indemnify, hold harmless and defend PEGASUS and its suppliers from and against any claims or lawsuits, including attorney's fees that arise or result from the use or distribution of TOOLKIT in violation of this Agreement.

This Agreement is governed by the laws of the State of Florida. The program and data contained in this TOOLKIT Product are provided with Restricted Rights. Use, duplication, or disclosure by the U.S. Government is subject to restrictions as set forth in FAR 52.227-14 (Alternate III) or subparagraph (c)(1)(II) of the rights in technical data and computer software clause at 252.227-7013. Manufacturer is Pegasus Imaging Corporation, 4001 Riverside Drive, Tampa, FL, 33603.

For questions concerning this Agreement, or to contact PEGASUS for any reason, please contact Pegasus Imaging Corporation by phone at 1-813-875-7575 x321 or email Sales@JPG.com.

See Also

Trial Mode | Development Mode | Run Time Licensing | Distributing with Your ActiveX Application


Verify You Are Using the Latest Service Pack

Service pack updates will not overwrite paid licensing. Your paid licensing will continue to work and you will not be required to re-enter your purchased registration codes. Service pack updates do not include any changes that could "break" previously developed and/or deployed code.

Verify Latest Development Components

To verify you are using the latest version of a Pegasus Imaging Development Component or Components, please use the PegConnect utility program. Please note that a Help File for each product may be found on the Start Bar under Pegasus, or in C:\Windows\Help.

PegConnect is installed by all component product installers and is accessible through the Windows Start menu:

Start | Programs | Pegasus Imaging | Common | Utilities

PegConnect Allows You To:

  1. Check with Pegasus Imaging via online connection and verify that the installed version of the component includes all the most recent updates
  2. Update to the latest version automatically with your permission
  3. Determine if a control is registered or unregistered on the machine
  4. Easily change the registration status from registered to non-registered, or non-registered to registered

Alternatively, you can see the currently released product build numbers at www.PegasusImaging.com/latestbuilds.htm.

If you require further assistance or have questions or comments, please see the topic on Getting Support for more detailed information.

See Also

Getting Support and Samples | Installing on a Development Machine


Distributing with Your ActiveX Application

Check for Proper Licensing and Unlock Codes

TwainPRO™ contains a locking mechanism that does not permit you to distribute applications created with evaluation versions of TwainPRO. Prior to distributing an application that utilizes TwainPRO, you must purchase and enable run-time licensing. If the application will be delivered on the web, you must also enable web application licensing.

DLL Files to Distribute

Distribute the appropriate files with applications using the TwainPRO Product:

  • PegasusImaging.ActiveX.TwainPRO5.dll — ActiveX Control library.

Note: You must also distribute STDOLE2.TLB and OLEAUT32.DLL that are Microsoft support files. These must be registered prior to registering PegasusImaging.ActiveX.TwainPRO5.dll.

The following files are required by TwainPRO but should be installed by the Data Source. TwainPRO will work with any version of the TWAIN DLLs, however, we have found many Data Sources are only compatible with the TWAIN DLLs they ship. For this reason, we do not recommend shipping the TWAIN DLLs unless your application will only be working with a particular source. The latest version of these DLLs can be found at www.Twain.org.

TWAIN.DLL — 16-bit TWAIN DLL

TWAIN_32.DLL — 32-bit TWAIN DLL

TWUNK_16.EXE — 16-bit thunking layer for 16-Bit Data Sources

TWUNK_32.EXE — 32-bit thunking layer for 32-Bit Data Source

See Also

Getting Support and Samples | Installing on a Development Machine | Development Mode | Run Time Licensing | License Agreement | Verify You Are Using the Latest Service Pack


Definitions, Acronyms and Abbreviations

Pegasus Imaging Definitions, Acronyms, and Abbreviations

PIC: Pegasus Imaging Corporation

Thread-safe: An application using this component can use multiple controls running in the same process, where they don't interfere with each other. The thread creating the control owns the control and is the only thread that can interact with it.

Industry Definitions, Acronyms, and Abbreviations

See the TWAIN Specification for more information on TWAIN-Specific terms.

Capability - the options offered by a Data Source device. For example, devices may have automatic document feeders, may enable single or multiple image transfers, support color images, etc.

Capability Container - Capabilities have one of four containers, that define the structure of information. Containers include:

    • TW_ONEVALUE - a single value
    • TW_ARRAY - a rectangular array of values
    • TW_RANGE - a range of allowed values
    • TW_ENUMERATION - a list of valid values

Capability Negotiation - The application influences the data source's capability settings through capability negotiation. By determining if the source supports a capability, checking the current value of that capability, and setting the capability to the desired value, then verifying that new values have been accepted by the source.

Data Source (DS) - The image acquisition device, written to comply with the TWAIN specification.

Data Source Manager (DSM) - The software that manages interactions between the application and the Data Source. This code is provided in the TWAIN Developer's Toolkit and should be shipped for free with each TWAIN application and Data Source.

Extended Information - Information associated with the image on the page, such as a barcode.

Transfer Mode - Describes how data is transferred from the Data Source to the Application. Three modes are available: native, disk file, and buffered memory.

TWAIN Identity - A unique identifier of the TWAIN application or Source.


Overview of TWAIN

TWAIN defines a standard software protocol and application programming interface (API) for communication between software applications and image acquisition devices.

Users need a way to get image data into their applications. Software developers need compatibility with the widest range of output devices without writing and maintaining multiple device drivers.

The solution to this situation is an open industry interface (TWAIN) that directly acquires image data from external sources while within an application.

With this, each software developer supports a standard data acquisition manager and each hardware vendor writes one driver for their device. Hardware vendors benefit because they need only provide one standard driver for their device, which can then be used by all software applications supporting the TWAIN data acquisition interface.

Three Key Elements in TWAIN

  1. The Application software — An application which has been written to use TWAIN.

  2. The Data Source Manager software — The software which manages the interaction between the application and Data Source. This manager (TWAIN32.DLL) should be shipped for free with each Data Source.

  3. The Data Source software — The software which controls the image acquisition device which has been written to comply with the TWAIN specifications. It is generally supplied by the acquisition device manufacturer.

TWAIN defines how application developers can acquire image data directly into their application without requiring the user to switch out of the application. To provide this feature, TWAIN requires Data Sources to provide a built-in user interface (UI) for their device. Application developers can, if they choose, disable the built-in User Interface provided by the Data Source and provide their own User Interface to control TWAIN devices.

Support for disabling the built-in User Interface must be provided by the Data Source.


Supported File Formats

TwainPRO™ supports the following file formats:

PDF

Portable Document Format, a file format created by Adobe® System to represent documents independently of the application software, hardware, and operating system used to create them, and independently of the output device on which they are displayed or printed.

BMP

The Microsoft Windows Bitmap file format is based on the Windows internal bitmap data structures. The BMP format is widely used and it is quick and easy to read.

JPEG

The JPEG (Joint Photographic Expert Group) standard is one of the most important image data compression standards. It is widely used in many industries and is becoming the most widely used image format for the Internet.

JPEG Compression is a lossy format that can achieve very high compression ratios. The compression level is adjustable by varying the SaveJPEGChromFactor and SaveJPEGLumFactor properties.

Progressive JPEG is a multiple-scan sequential JPEG format that is becoming popular for its ability to display images in progressively clearer segments.

ePIC

Pegasus enhanced PIC image format (.PIC). This high performance image compression combines the patented ELS arithmetic coder with the high performance Pegasus JPEG libraries. The result is a new and unbeatable compression technology.

The ePIC compression has significant advantages over standard JPEG. Most importantly it produces smaller file sizes and decompresses extremely quickly. Other features include password encryption, and scaling and cropping without recompression. All Pegasus products support the ePIC file format.

TIFF

TIFF (Tag Image File Format) originally released by Aldus Corporation is a standard file format found in most print, imaging, and desktop publishing programs. TIFF is extremely powerful, flexible, and extensible.

For TIFF, the compression is selected by the SaveTIFFCompression property. For images above 1-bit, the compression will be uncompressed regardless of this property setting.


Quick Start - Acquire a TWAIN Image

Your application needs only two support features for TWAIN compliance:

  • Data Source (DS) selection

  • Image acquisition through the Data Source User Interface (UI)

The two standard methods supplied by TwainPRO™ are SelectSource and StartSession.

SelectSource displays the TWAIN Data Source Manager's User Interface with the default Data Source highlighted. The user selects the Data Source he or she wishes to use then selects the OK or Cancel buttons.

The StartSession method displays the current or default Data Source User Interface for image acquisition. Any capabilities that the user wishes to change will have to be changed through the Data Source User Interface.

VB Example:

' This code demonstrates how to select the Data Source UI and then acquire an image from the Data Source

TwainPRO1.SelectSource

TwainPRO1.StartSession

' After the image is acquired you can place it into the windows,

' clipboard then into other applications or controls.

Private Sub TwainPRO1_PostScan()

TwainPRO1.CutToClipboard

Picture1.Picture = Clipboard.GetData(vbCFDIB)

End Sub

See Also

SelectSource Method | StartSession Method


Set the Application's TWAIN Identity

All TWAIN Data Sources and applications have a TWAIN Identity. This identity enables the TWAIN Data Source Manager (DSM) to keep track of all running TWAIN applications and Data Sources.

A TWAIN Identity consists of four strings:

    • ProductName,
    • ProductFamily,
    • Manufacturer and
    • VersionInfo.
These properties must be set prior to starting a TWAIN Session (OpenSession).
See Also

ProductName Property | ProductFamily Property | Manufacturer Property | VersionInfo Property | OpenSession Method


Enable Extended Capabilities

Some non-compliant TWAIN drivers don't properly handle a query for support of extended capabilities (CAP_FEEDPAGE and CAP_CLEARPAGE).

If you do not plan to use these capabilities, set EnableExtCaps to False.

The Data Source should be set before opening a TWAIN session (OpenSession).
See Also

EnableExtCaps Property | OpenSession Method


Set the Transfer Mode

The TwainPRO™ control now lets you determine the method of transfer you wish to use with the Data Source.

The TransferMode property should be set before starting a TWAIN Session (OpenSession).

Native Transfer Mode

By default, TwainPRO control uses Native transfer mode which is the simplest to use because the Data Source is responsible for providing a DIB directly to the control.

Buffered Memory Transfer

An alternative mode of transfer, buffered memory transfer, specifies that data from the Data Source is transferred in blocks of data. In buffered memory transfer mode, the TwainPRO control is responsible for converting the data received from the scanner to the proper format. Typically this would be a standard DIB. This method of transfer can be faster on computers with lesser amounts of memory or higher-end scanners.

The data can be negotiated with the Data Source through the ICAP_COMPRESSION to be in compressed format. This results in a TIFF or JPEG file being created in memory so that less memory is used and the transfer time from the Data Source to the application is lower.
See Also

TransferMode Property | OpenSession Method


Select a Data Source

The Data Source for the TWAIN session must now be identified.

The Data Source should be set before starting a Session (OpenSession).

Using the Data Source Manager's User Interface (DSM UI)

To enable the application end user to select a Data Source using the Data Source Manager's User Interface, use SelectSource. The DataSource Manager's UI will display with the default Data Source highlighted. The user selects the Data Source desired then selects the OK or Cancel button.

Without the TWAIN DSM UI

TwainPRO™ can retrieve the list of Data Sources (DS) on the current system and set the current Data Source, without using the DSM User Interface.

In order to obtain a list of the Data Sources you must call the OpenDSM method first. OpenDSM fills the DataSourceList array property with a list of all Data Source product names. It will also set the DataSourceCount property to the number of Data Source product names within the DataSourceList array.

To select a current Data Source from the DataSourceList, you call the SetDataSource method with the index number of the Data Source from the DataSourceList array.

See Also

OpenSession Method | SelectSource Method | OpenDSM Method | DataSourceList Property | DataSourceCount Property | SetDataSource Method


Open the TWAIN Session

Prior to Opening the TWAIN Session, the following should be done:

  • Set the Application's TWAIN Identity
  • Set the Transfer Mode
  • Select a Data Source

The application opens a TWAIN session by calling the OpenSession method. Once a Twain Session has been initiated, the application can read and modify Data Source capabilities, and specify instructions for scanning, such as scanning DPI and layout.

See Also

OpenSession Method | Set the Application's TWAIN Identity | Set the Transfer Mode | Select a Data Source


Glossary Item Box

OpenSession Method | StartSession Method | Capability Property | CapSupported Property | CapType Property | CapValue Property | CapDefault Property | CapNumItems Property | CapItem Property | CapMin Property | CapMax Property | CapStep Property

See Also PegasusImaging.ActiveX.TwainPro5 Send comments on this topic.

Check Capabilities

Data Sources have different capabilities (e.g. levels of resolution, support of color or black and white images, automatic document feeder available, etc.). Applications can check the capabilities available for the selected Data Source, and can also set those capabilities to its desired settings.

Capabilities can be checked once a TWAIN Session has been opened (OpenSession), and before or after a scanning session has been initiated (StartSession).

Select a Capability to Check

First specify the capability to be read, by setting the Capability property.

Check that the Capability is supported by the Data Source

To determine whether the selected Capability is supported by the Data Source, read the CapSupported property.

Check the Type of Container used by the Data Source

If the capability is supported by the Data Source, read the CapType property to determine the type of container used by the Data Source to pass values back to TwainPRO™.

Read the Capability Values

The relevant properties to access for a capability are determined by the container used (CapType). TWAIN defines four types of containers to negotiate values between the application (TwainPRO) and the Source:

  • TWON_ONEVALUE: The current value is returned

Relevant Properties To Check: CapValue

  • TWON_ENUM: A list of legal values along with the current and default values are returned

Relevant Properties To Check: CapValue, CapDefault, CapNumItems, CapItem

  • TWON_RANGE: A range of legal values along with the current and default values are returned

Relevant Properties To Check: CapValue, CapDefault, CapMin, CapMax, CapStep

  • TWON_ARRAY: A list of values is returned

Relevant Properties To Check: CapNumItems, CapItem

VB Example:

' This code demonstrates how to read a value

' Check for support and stop if none

If (TwainPRO.CapSupported = False) Then

LblDefault.Caption = "Not supported"

LblDefault.Visible = True

Exit Sub

End If

' What data type is the Cap? We have to check the

' data type to know which properties are valid

Select Case TwainPRO.CapType

' Type ONEVALUE only returns a single value

Case TWON_ONEVALUE

EdtCurrent.Text = TwainPRO.CapValue

EdtCurrent.Visible = True

' Type ENUM returns a list of legal values as

' well as current and default values. A list

' of constants is returned and the CapDesc

' property can be used to find out what the

' constants mean

Case TWON_ENUM

EdtCurrent.Text = TwainPRO.CapValue

EdtCurrent.Visible = True

LblDefault.Caption = "Default = " & TwainPRO.CapDefault

LblDefault.Visible = True

List1.AddItem "Legal Values:"

For Index = 0 To TwainPRO.CapNumItems - 1

List1.AddItem TwainPRO.CapItem(Index) & " - " & TwainPRO.CapDesc(TwainPRO.CapItem(Index))

Next

List1.Visible = True

' Type ARRAY returns a list of values, but no

' current or default values.

Case TWON_ARRAY

List1.AddItem "Legal Values:"

For Index = 0 To TwainPRO.CapNumItems - 1

List1.AddItem TwainPRO.CapItem(Index)

Next

' Returns a range of values as well as current and

' default values

Case TWON_RANGE

EdtCurrent.Text = TwainPRO.CapValue

EdtCurrent.Visible = True

LblDefault.Caption = "Default = " & TwainPRO.CapDefault

LblDefault.Visible = True

LblMin.Caption = "MinValue = " & TwainPRO.CapMin

LblMin.Visible = True

LblMax.Caption = "MaxValue = " & TwainPRO.CapMax

LblMax.Visible = True

End Select

See Also

OpenSession Method | StartSession Method | Capability Property | CapSupported Property | CapType Property | CapValue Property | CapDefault Property | CapNumItems Property | CapItem Property | CapMin Property | CapMax Property | CapStep Property


Glossary Item Box

OpenSession Method | StartSession Method | Capability Property | CapSupported Property | CapTypeOut Property | CapValueOut Property | CapNumItemsOut Property | CapItemOut Property | CapMinOut Property | CapMaxOut Property

See Also PegasusImaging.ActiveX.TwainPro5 Send comments on this topic.

Set Capabilities

Once a capability negotiation session has been initiated (OpenSession has been called), the Data Source capabilities can be modified to desired settings.

Capabilities can only be modified, or set, after a TWAIN Session has been opened (OpenSession), and prior to initiating the scanning session (StartSession).

Select a Capability to Set

First specify the capability to be set, by setting the Capability property.

Check that the Capability is supported by the Data Source

To determine whether the selected Capability is supported by the Data Source, read the CapSupported property.

Check the Type of Container used by the Data Source

Set the CapTypeOut property to specify the type of container used to pass information from TwainPRO™ to the Data Source.

Set the Capability

The relevant properties to set for the capability depend on the specified CapTypeOut. TWAIN defines four types of containers to negotiate values between the application (TwainPRO) and the Source:

  • TWON_ONEVALUE: The current value is returned

Relevant Properties To Set: CapValueOut

  • TWON_ENUM: A list of legal values along with the current and default values are returned

Relevant Properties To Set: CapValueOut, CapNumItemsOut, CapItemOut

  • TWON_RANGE: A range of legal values along with the current and default values are returned

Relevant Properties To Set: CapValueOut, CapMinOut, CapMaxOut

  • TWON_ARRAY: A list of values is returned

Relevant Properties To Set: CapNumItemsOut, CapItemOut

Once the properties are set, the SetCapOut method must be called to negotiate the new values.

VB Example:

' This code demonstrates setting a single value using the TWON_ONEVALUE container

' Let's make sure the user entered valid data

If False = IsNumeric(EdtCurrent.Text) Then

MsgBox "You must enter a real number for the new current value."

End If

TwainPRO.CapTypeOut = TWON_ONEVALUE

TwainPRO.CapValueOut = EdtCurrent.Text

TwainPRO.SetCapOut

VB Example:

' The following code will request that the Data Source only allow resolutions in the range of 100 to 400 dpi (assuming the ICAP_UNITS cap is set to inches).

TwainPRO.CapTypeOut = TWON_RANGE

TwainPRO.CapValueOut = 100

TwainPRO.CapMinOut = 100

TwainPRO.CapMaxOut = 400

TwainPRO.SetCapOut

See Also

OpenSession Method | StartSession Method | Capability Property | CapSupported Property | CapTypeOut Property | CapValueOut Property | CapNumItemsOut Property | CapItemOut Property | CapMinOut Property | CapMaxOut Property


Set Advanced Capabilities

The TWAIN specification defines advanced capabilities of the Data Source. The advanced capabilities are enumerated in TP_AdvancedCapability.

Prior to initiating a Scanning Session, the application may specify values for advanced capabilities. To set advanced capabilities, first set the Capability property to use advanced capabilities (TP_Capability_UseCapAdvanced), then specify the specific advanced capability by setting the CapAdvanced property.

VB Example:

' This code demonstrates how to set an advanced capability

TwainPRO1.Capability = TP_Capability_UseCapAdvanced

TwainPRO1.CapAdvanced = ICAP_BARCODEDETECTIONENABLED

If (TwainPRO1.CapSupported) Then

TwainPRO1.CapTypeOut = TWON_ONEVALUE

TwainPRO1.CapValueOut = 1

TwainPRO1.SetCapOut

End If

See Also

TP_AdvancedCapability Enumeration | CapAdvanced Property


Set Advanced Capabilities for Extended Information

What is Extended Image Information?

Extended image information is used to pass information such as barcodes or patch codes found on a scanned page. See the TWAIN specification for additional information on Extended Image Information available for retrieval.

The TWAIN Data Source must be compliant with version 1.7 or higher of the TWAIN specification for accessing this extended information.

Allocate the Extended Image Information Array

The TwainPRO™ control uses an array to access the extended image information. This array once allocated will persist until the user frees it or the TwainPRO control is destroyed. To allocate the array the user needs to set the CapExtInfoCount property to a value greater than zero. Every time this value is set the array will be re-allocated and the information requested for each index should be reset. A value of zero will free the array.

To create an extended image information array with 4 values to retrieve the following is done:

TwainPRO.CapExtInfoCount = 4

Initialize the Extended Image Information Array

To be able to use the extended image information mechanism, the Capability property must be set to TP_Capability_UseCapAdvancedFOREXTINFO as below:

TwainPRO.Capability = TP_Capability_UseCapAdvancedFOREXTINFO

In order to request the extended image information each element in the array must be set with information Id that is requested. This is done by using the CapExtInfoIndex property to move through the array and the CapAdvanced property to set each element with an Id of the requested value. For instance the following fills in the array with the extended information that is requested, barcode count, barcode types, barcode text lengths and the barcode texts:

TwainPRO.CapExtInfoIndex = 0

TwainPRO.CapAdvanced = TWEI_BARCODECOUNT

TwainPRO.CapExtInfoIndex = 1

TwainPRO.CapAdvanced = TWEI_BARCODETYPE

TwainPRO.CapExtInfoIndex = 2

TwainPRO.CapAdvanced = TWEI_BARCODETEXTLENGTH

TwainPRO.CapExtInfoIndex = 3

TwainPRO.CapAdvanced = TWEI_BARCODETEXT

Request and Access the Extended Image Information

The extended image information is requested and accessed during the PostScan event during image acquisition (see Access Extended Image Information).

See Also

CapExtInfoCount Property | CapExtInfoIndex Property | CapAdvanced Property | Access Extended Image Information


Set Image DPI

One capability that is often set by the application is the desired DPI of the scanned image. To set the DPI for scanned images, use the TWAIN capabilities: ICAP_XRESOLUTION and ICAP_YRESOLUTION.

It is important to set the ICAP_UNITS capability equal to TWUN_INCHES prior to setting the resolution capabilities.

VB Example:

' This code demonstrates how to set the DPI of scanned images to 300 DPI

TwainPRO1.Capability = ICAP_UNITS

If TwainPRO1.CapSupported Then

TwainPRO1.CapTypeOut = 0

TwainPRO1.CapValueOut = 0

TwainPRO1.SetCapOut

End If

TwainPRO1.Capability = ICAP_XRESOLUTION

If TwainPRO1.CapSupported Then

TwainPRO1.CapTypeOut = 0

TwainPRO1.CapValueOut = 300

TwainPRO1.SetCapOut

End If

TwainPRO1.Capability = ICAP_YRESOLUTION

If TwainPRO1.CapSupported Then

TwainPRO1.CapTypeOut = 0

TwainPRO1.CapValueOut = 300

TwainPRO1.SetCapOut

End If

Image Resolution can only be modified, or set, after a TWAIN Session has been opened (OpenSession), and prior to initiating the scanning session (StartSession).

See Also

OpenSession Method | StartSession Method


Define a Caption

A caption is text that is placed on a still frame when scanning. TwainPRO™ enables the user to define a caption to be placed on all scanned images. When a caption is applied during scanning, it becomes a part of the scanned image data, and is no longer separable from the image.

To define a caption, set the Caption properties prior to initiating image acquisition (prior to StartSession). The Caption properties enable the application to specify the text, appearance, and location of the caption. During the scanning session, the caption will be applied to all acquired images.

If no caption is needed, ensure that the Caption property is set to null (the default value) prior to StartSession.

Caption can only be modified, or set, prior to initiating the scanning session (StartSession).

See Also

Caption Property | StartSession Method


Specify Image Layout

The desired layout size for scanned images can be specified prior to initiating a scanning session, by calling SetImageLayout. This method sets the Left, Top, Right, and Bottom sides of the Image Layout rectangle for the current Data Source. The Image Layout rectangle defines what portion of the Data Source's scanning area is acquired.

It is also a good idea to set the ICAP_UNITS capability for the scanner prior to using the SetImageLayout method to specify the unit of measure you'll be using.

VB Example:

' This code demonstrates how to set the Image Layout rectangle to 6.5 inches X 9 inches

TwainPRO1.Capability = ICAP_UNITS

If TwainPRO1.CapSupported = True Then

TwainPRO1.CapTypeOut = TWON_ONEVALUE

TwainPRO1.CapValueOut = 0 ' set units to Inches

TwainPRO1.SetCapOut

End If

TwainPRO1.SetImageLayout 1, 1, 7.5, 10

Image Layout can only be modified, or set, prior to initiating the scanning session (StartSession).

See Also

SetImageLayout Method | OpenSession Method | StartSession Method


Initiate a Scanning Session

Prior to initiating a scanning session, the following should be done:

  • Open a TWAIN Session
  • Negotiate Capabilities
  • Define a Caption (if desired)
  • Specify Image Layout

Once a Scanning session has been initiated (StartSession), capabilities, caption, and layout can be checked, but can no longer be modified.

Using the Data Source UI

To enable the application end user to initiate image acquisition, call the StartSession method. The Data Source User Interface then displays the current or default Data Source User Interface for image acquisition.

VB Example:

' This code demonstrates how to display the Data Source UI and then Acquire an image from the Data Source

TwainPRO1.SelectSource

TwainPRO1.StartSession

' After the image is acquired you can place it into the windows

' clipboard then into other applications or controls.

Private Sub TwainPRO1_PostScan()

TwainPRO1.CutToClipboard

Picture1.Picture = Clipboard.GetData(vbCFDIB)

End Sub

Without Using the Data Source UI

The TwainPRO™ ShowUI property is used to set the Data Source User Interface visibility. To hide the Data Source's User Interface, set ShowUI to false prior to calling the StartSession method.

When acquiring an image without the Data Source User Interface, you must take into account that the default image size and resolution capabilities may create a very large image and your system may not have enough memory for the image transfer. Check the image height, width and resolution settings using GetImageLayout method and capability respectively. If these values are outside of your parameters then you can change them with the SetImageLayout and SetCapOut methods.

Once a Scanning Session has been initiated (StartSession), Data Source capabilities can be checked, but can no longer be modified.
See Also

Open the TWAIN Session | Negotiate Capabilities | Define a Caption | Specify Image Layout | StartSession Method | ShowUI Property | GetImageLayout Method | SetImageLayout Method | SetCapOut Method


Transfer and Save Images

Once a scanning session has been initiated by calling StartSession, one or more images can be scanned by the Data Source, transferred from the Data Source to the application, and saved by the application to file or memory.

Check for Pending Transfers

Prior to initiating a transfer of a scanned image from the Data Source to the application, TwainPRO™ raises a PreScan event. This event is the trigger to check the pending transfers. The PendingXfers property will contain the number of images the Data Source has ready for transfer. If the Data Source doesn't know how many images are ready for transfer, PendingXfers will be equal to -1. TWAIN Data Sources with Automatic Document Feeders (ADF) will return PendingXfers equal to -1. Such devices will transfer images until the feeder is empty.

Transfer Images from Data Source to Application

Upon proceeding from the PreScan event, pending images will be transferred from the Data Source to the application.

Save Scanned Images

When the transfer of each image is complete, TwainPRO raises a PostScan event. This event is the trigger to save the image to file or memory.

During the PostScan event, the hDIB property contains the latest scanned image. This information will be lost once the transfer of another image is initiated. Therefore, the application must select a method for saving the scanned image prior to initiating the next scan.

  • To save this image to file, first specify instructions for saving, by setting the "Save" properties. Then invoke the SaveFile method to save the file according to the properties set.
  • To move the data to an ImagXpress® control, assign the TwainPRO hDIB to ImagXpress hDIB. For example:

ImagXpress.hDIB = TwainPRO.hDIB

  • You may also move the data to the Window's Clipboard with the CutToClipBoard method.

Finish Scanning

Upon exiting the Post-Scan event, the acquisition process continues, by triggering another Pre-Scan event. At any point during the Pre-Scan, Image Transfer, or Post-Scan states, the application can call CancelPendingXfers to terminate the scanning session. Alternatively, setting the Cancel parameter in the Pre-Scan or Post-Scan events will also terminate the scanning session.

VB Example:

' This code demonstrates how to save to a multi-page file

Private Sub TwainPRO1_PostScan(Cancel As Boolean)

' When scanning from a document feeder,

' the PostScan event will fire after each page is scanned.

TwainPRO1.SaveTIFFCompression = TWTIF_CCITTFAX4

TwainPRO1.SaveMultiPage = True

TwainPRO1.SaveFile App.Path & "\multiPage.tiff"

End Sub

VB Example:

' This code demonstrates how to start a TWAIN session and place each image into a Picture control array

Private Sub cmdStart_Click()

scancount = 0

TwainPRO1.StartSession

End Sub

Private Sub TwainPRO1_PostScan(Cancel as Boolean)

PictureBox1(scancount).Picture = TwainPRO1.Picture

scancount = scancount + 1

End Sub

VB Example:

' This code demonstrates how to successfully negotiate the transfer mode and to transfer data in a compressed format

' Set the Transfer Mode to buffered memory mode

TwainPRO.TransferMode = TWSX_MEMORY

TwainPRO.OpenSession

If (TwainPRO.TransferMode = TWSX_MEMORY) Then

TwainPRO.CapTypeOut = TWON_ONEVALUE

TwainPRO.Capability = TP_Capability_UseCapAdvanced

TwainPRO.CapAdvanced = ICAP_COMPRESSION

If TwainPRO.CapSupported Then

TwainPRO.CapValueOut = TWCP_JPEG

TwainPRO.SetCapOut

'Normally then you would negotiate the ICAP_JPEGPIXELTYPE

'and ICAP_JPEGQUALITY capabilities.

'Using the defaults for both of these values

End If

End If

TwainPRO.StartSession

' A simple typical PostScan event handler.

Private Sub TwainPRO_PostScan(Cancel As Boolean)

Dim hImage As Long

On Error GoTo psError

' Need to check the Compression type to see

' if we are transferring a DIB or we are

' transferring compressed data.

If TwainPRO.ICompression = TWCP_NONE Then

hImage = TwainPRO.hDIB

If (hImage <> 0) Then

ImgXpr.hDIB = hImage

End If

Else

hImage = TwainPRO.hImage

If (hImage <> 0) Then

ImgXpr.LoadBuffer (hImage)

End If

End If

Exit Sub

psError:

GetError

Cancel = True

End Sub

See Also

StartSession Method | PreScan Event | PendingXfers Property | PostScan Event | hDIB Property | SaveFile Method | CutToClipboard Method | CancelPendingXfers Method


Transfer and Save Multi-page Images

Fast Saving of Multi-page TIFF files (generally over 1000 pages)

When the SaveUseIFDOffset property is false (default), the image is appended to the end of the multi-page TIFF. Due to the linked format of TIFF, the software must traverse all the link pointers to identify the location to which the new page will be appended. The greater the number of pages in the target TIFF file, the longer the write process takes. (Typically, if the target file has more than 1000 pages, the write speed will degrade substantially.)

Setting the SaveUseIFDOffset property to true specifies that the control should write the image to the location stored in the SaveIFDOffset property. This enables much faster writing of TIFF files with many pages because the software can seek to that location without traversing all previous pointer links. This process gives very predictable speeds in adding pages to a multi-page TIFF file.

Important: If the file's IFDOffset ever became out of sync with the SaveIFDOffset property value, file corruption could occur. To protect the application from inadvertently corrupting a saved mutli-page file, the Twain PRO™ control takes the following measures:

  • If the application sets the SaveUseIFDOffset property to true or false, the SaveIFDOffset property is automatically set to zero. The application must then explicitly set the IFD Offset to be used.
  • Executing the SaveFile method will automatically set the SaveUseIFDOffset property to false. The application must then explicitly set the value back to true as needed.
  • When the SaveIFDOffset property is zero, a normal write (not fast TIFF write) will occur regardless of the SaveUseIFDOffset value. The fast write will take place only when SaveIFDOffset is set to non-zero and the SaveUseIFDOffset is set to true.

VB Example:

' This code demonstrates how to use the SaveUseIFDOffset and SaveIFDOffset properties to safely enable fast TIFF writing

Dim outputFile As String
Dim myIfdOffset As Long

Public Sub SaveMpTiffUsingIfd()
tp.SaveMultiPage = True
tp.SaveFileType = TP_SaveFileType_Tiff
outputFile = App.Path & "\mpIfd.tif"
Dim fso As New FileSystemObject
If fso.FileExists(outputFile) Then
Kill outputFile
End If
Set fso = Nothing
tp.StartSession
End Sub

Private Sub tp_PostScan(Cancel As Boolean)
tp.SaveUseIFDOffset = True
tp.SaveIFDOffset = myIfdOffset
tp.SaveFile outputFile
myIfdOffset = tp.SaveIFDOffset
End Sub

See Also

SaveUseIFDOffset Property | SaveIFDOffset Property


Glossary Item Box

Set Advanced Capabilities for Extended Information | GetExtInfo Method | CapValue Property | CapString Property | CapItem Property | CapItemString Property | CapExtInfoIndex Property | CapType Property | CapNumItems Property | CapSupported Property

See Also PegasusImaging.ActiveX.TwainPro5 Send comments on this topic.

Access Extended Image Information

Acquisition of extended image information is enabled by setting advanced capabilities to acquire extended image information, prior to initiating the scanning session.

Request Extended Image Information

The extended image information is populated with the values from the Twain Data Source during the PostScan Event, by calling the GetExtInfo method:

Private Sub TwainPRO_PostScan(Cancel As Boolean)

TwainPRO.GetExtInfo

End Sub

Access Extended Image Information

The returned extended image information values is done in pretty much the same manner as you do to get the values for a capability. The CapValue , CapString , CapItem , and CapItemString properties are the way to retrieve the value for each element in the array that was previously set up. Again to access each element the program must move through the array by using the CapExtInfoIndex property.

The CapType property can be used to determine whether the returned information is a single value or an array of values. This can also be determined by looking at the property CapNumItems. A value of one for CapNumItems means a single item has been returned which is the same as CapType being equal to TWON_ONEVALUE. A value greater than one for CapNumItems is the same as CapType being equal to TWON_ARRAY. These are the only values that CapType can be for extended image information. To determine if the TWAIN Data Source was able to fill in any value then the CapSupported function can be used.

VB Example:

' This code demonstrates how to access the previously requested extended image information

' Get the Barcode Count

TwainPRO.CapExtInfoIndex = 0

If (TwainPRO.CapSupported) Then

nBarCodeCount = TwainPRO.CapValue

End If

' Get the Barcode Types

TwainPRO.CapExtInfoIndex = 1

If (TwainPRO.CapSupported) Then

If (TwainPRO.CapType = TWON_ONEVALUE )

nBarCodeTypes[0] = TwainPRO.CapValue

Else

For nIndex = 0 To TwainPRO.CapNumItems - 1

nBarCodeTypes[nIndex] = TwainPRO.CapItem(nIndex)

Next

End if

'Get the Barcode Strings

TwainPRO.CapExtInfoIndex = 3

If (TwainPRO.CapSupported) Then

If (TwainPRO.CapType = TWON_ONEVALUE )

strBarCode[0] = TwainPRO.CapString

Else

For nIndex = 0 To TwainPRO.CapNumItems - 1

strBarCode[nIndex]= TwainPRO.CapItemString(nIndex)

Next

End If

End If

See Also

Set Advanced Capabilities for Extended Information | GetExtInfo Method | CapValue Property | CapString Property | CapItem Property | CapItemString Property | CapExtInfoIndex Property | CapType Property | CapNumItems Property | CapSupported Property


End a TWAIN Session

The TWAIN Session can be ended at any point. The actions to be taken depend on the state of the session.

During Data Source Selection:

OpenDSM or SelectSource has previously been called to open the Data Source Manager. Call CloseSession to close the Data Source Manager and terminate the TWAIN session.

During Capability Negotiation:

OpenSession has previously been called to open the Data Source Manager and Data Source. Call CloseSession to close the Data Source and Data Source Manager and terminate the TWAIN session.

During a Scanning Session:

StartSession has previously been called to begin a scanning session. The TWAIN session can be terminated during the PreScan or PostScan event by setting the Cancel parameter. The TWAIN session can be cancelled during image transfer or during the PreScan or PostScan events by setting CancelPendingXfers. Either of these actions will cancel all pending image transfers, close the Data Source and the Data Source Manager, and terminate the TWAIN session.

See Also

CloseSession Method | CancelPendingXfers Method


Debug

I am encountering a problem with a TWAIN Device.

If you have a problem with a Twain device we recommend trying the following things:

  1. Get the latest version of the scanner's drivers from the manufacturer's web site and re-install them.

  2. Get the latest Twain Data Source Manager files from www.Twain.org and put them in your windows directory (NOT the windows\system directory). Also, make sure you don't have older versions of those DLLs or EXEs anywhere else in your path.

  3. Make sure you have the latest version of TwainPRO™.

  4. If you still have a problem with a particular scanner, let us know, but remember, not all TWAIN capabilities are supported by all devices and there are TWAIN drivers out there that have bugs in them and are not fully TWAIN compliant.

It appears that setting a capability has no effect on the scanned image.

There are a couple of reasons this issue may be occurring:

Resolution 1:

Please make sure that you call OpenSession before setting the capabilities. For example:

TwainPRO1.SelectSource

TwainPRO1.ShowUI = False

TwainPRO1.OpenSession

Resolution 2:

Not all TWAIN devices support all TWAIN capabilities. Because of this, you must check to see if a TWAIN capability is supported by your device before setting it.

To do this, TwainPRO™ provides a method called CapSupported, which will return True if the capability is supported and False if not. Note that if a scanner supports a capability, it might only support getting it and does not necessarily support setting it.

Below is an example of how to check this property:

TwainPRO1.Capability = ICAP_PIXELTYPE

If (TwainPRO1.CapSupported) Then

' If setting capability is supported this code will be executed

End If

I want to drive a scanner via the Kofax VRS TWAIN driver without using the Kofax TWAIN UI.

Kofax VirtualReScan (VRS) works best with an ISIS driver and only supports some scanners with TWAIN drivers. Documentation for Kofax VRS can be found at www.kofax.com/support/IP/VRS/4.1/4.1_downloads.asp#ProductDocumentation.

Error Codes

7000

TWERR_TWAIN

Twain error, check ErrorCode & ErrorString properties.

The Data Source has returned an error. Check the ErrorCode and ErrorString properties to see if the Data Source has returned an error code.

7001

TWERR_TINIT

Can't find or load twain_32.dll.

This file is not shipped with TwainPRO because it is generally provided by the Data Source. It should be located in the windows directory and not the windows\system directory. The latest version of this file can be found at http://www.twain.org.

PoPossible causes:

The file is missing.

The file is in use by another application.

7002

TWERR_FILEOPEN

TwainPRO can’t open an existing TIF file to append pages.

PoPossible causes:

The file is open in another control or application.

The file is read-only

7003

TWERR_MEMORYALLOC

TwainPRO was unable to allocate memory for the requested operation.

PoPossible causes:

The image being transferred is too large to fit in memory.

Too many applications are open.

7004

TWERR_CANCELLED

The user cancelled the requested operation.

PoPossible causes:

The user clicked the cancel button on the source selection dialog invoked by the SelectSource method.

7005

TWERR_CREATEFILE

TwainPRO was unable to create the file specified in the SaveFile method.

PoPossible causes:

The drive or path specified doesn’t exist.

The file exists and is in use by another application.

No file extension or an invalid file extension was specified.

7006

TWERR_FILEWRITE

An error occurred while TwainPRO was attempting to save a file to the path specified in the SaveFile method.

PoPossible causes:

The drive or path became invalid during the write. This can occur if the drive is a network drive.

The disk is full.

7007

TWERR_FORMATNOTSUPPORTED

A file extension for specified for a file type not supported by TwainPRO. Supported file types are: BMP,

JPEG, ePIC, and TIF.

7008

TWERR_BADLENGTH

A string with too many characters was set to a TwainPRO property.

PoPossible causes:

The application identity properties can accept a maximum length of 32 characters.

The PICPassword property can accept a maximum length of 8 characters.

7009

TWERR_BADVALUE

The value is out of range. An invalid value was set to a TwainPRO property.

PoPossible causes:

Many TwainPRO properties can only accept values in a specified range. For example, the SaveJPEGLumFactor property must be in the range 0-255.

7010

TWERR_NODIB

No image is available for the requested operation or an unsupported DIB format was returned in response to a StartSession.

PoPossible causes:

The hDIB property has already been read.

The SaveFile method was invoked after the hDIB property was read.

7011

TWERR_NOPICFILES

The required Pegasus dll file(s) are missing.

PoPossible causes:

Pegasus dll files are required when saving JPEG, ePIC, or TIF files. They are listed in the dependencies section.

7012

TWERR_NONETFILES

The required Internet dll file(s) are missing.

PoPossible causes:

The following files are not present on the system. These files are not shipped with TwainPRO and are not needed unless an FTP address is specified in the SaveFile method. These files are included with other software such as Internet Explorer, and if the machine has a TCP/IP connection, it should have these files.

wininet.dll

urlmon.dll

7013

TWERR_FTP

An error occurred trying to FTP an image.

PoPossible causes:

The machine is not currently connected to a network. The FTPUserName and/or FTPPassword properties are not correct for the requested host specified in the SaveFile method.

The host and or path specified in the SaveFile method doesn’t exist.

The path was not specified in the SaveFile method. A fully qualified URL containing both the servername and file path must be specified. For example, "http://ftp.myserver.com/ftp/public/test.jpg" contains both the server and file information, but "http://ftp.myserver.com" does not.

7014

TWERR_TSEQERROR

Illegal operation for current Source Manager or Source state. The requested action cannot be performed in the current state of the Twain session.

PoPossible causes:

Certain methods and properties are only valid during certain states. For example, the DataSourceList property is invalid unless the OpenDSM method was called to open the Data Source Manager.

7015

TWERR_BADINDEX

The requested index was out of range for the property array.

7016

TWERR_WRONGCAPTYPE

A property was set or queried that was not valid for the current capability type. Please see the Capability Negotiation section for more information.

7017

TWERR_CLIPBOARD

An error occurred trying to open the clipboard with the CopyToClipboard or CutToClipboard method.

PoPossible causes:

Another application has the clipboard open.

7018

TWERR_INTERNALERROR

Internal error.

7019

TWERR_BADBITCOUNT

Invalid image resolution for selected file format or an unsupported bits per pixel was returned from a StartSession.

PoPossible causes:

Tried to save a 1-bit or Black and White image to a jpg or pic file.

7020

TWERR_NOTAVAILABLE

The property requested is not currently available.

PoPossible causes:

This error is returned when the CapAdvanced property is being used and the requested capability function is not available. For instance, this error will be returned when the Capability property is set to TP_Capability_UseCapAdvanced and the property CapDesc is accessed. The CapDesc property is only available for the enumerated Capability values. Also this error will be returned when the Capability property is set to TP_Capability_UseCapAdvancedFOREXTINFO and the CapOut properties are accessed.

7021

TWERR_NOIMAGE

No compressed image is available for the requested operation or an unsupported compressed image format was returned in response to a StartSession.

PoPossible causes:

The hImage property has already been read.

The SaveFile method was invoked after the hImage property was read.

7022

TWERR_DSINVALIDOP

The Data Source performed an operation that caused an exception. This error is a critical error. If this error is received then the application should be terminated immediately. No other TwainPRO calls should be made after this error is received. This does give the application the chance to do any non-TWAIN clean-up processing as well as inform the user that a critical error has occurred.

PoPossible causes:

The Data Source TWAIN driver executed an illegal operation, such as an illegal memory access, a divide by zero, etc.

7023

TWERR_INVALIDLICENSE

Invalid license.

7024

TWERR_TIFFTAGNOTFOUND

TIFF tag not found.

7025

TWERR_TIFFTAGITEMNOTFOUND

TIFF tag item not found.

7026

TWERR_BADFILEREAD

Error reading file.

7027

TWERR_SETTINGSFILEINIT

An error occurred while initializing the settings file reader system.

7028

TWERR_SETTINGSFILETERM

An error occurred while terminating the settings file reader system.

7029

TWERR_FILENOTOPEN

An error occurred when opening the settings file.

7030

TWERR_NAMENOTFOUND

The TwainDevice Name attribute was not found in the settings file.

7031

TWERR_SCANNERNOTFOUND

Settings for the current scanner were not found in the settings file.

7032

TWERR_ENUMNOTFOUND

The Capability Enum attribute was not found in the settings file.

7033

TWERR_INVALIDFILENAME

Invalid file name.

7034

TWERR_FILENOTFOUND

The specified file was not found for the current LoadOptions operation.

7035

TWERR_PATHNOTFOUND

The specified path of the filename was not found.

7036

TWERR_FILEINUSE

The file is in use by another process and cannot be opened.

7037

TWERR_FILECLOSE

The file close operation could not be completed.

7038

TWERR_FILERESET

The file reset operation could not be completed.

7039

TWERR_TYPENOTFOUND

The Capability Type attribute was not found in the settings file.

Extended Error Codes

The following are error codes and strings that can be returned in the ErrorCode and ErrorString properties when TwainPRO™ returns a TWERR_TWAIN error.

1 | TWCC_BUMMER | General failure. Unload Source immediately.
2 | TWCC_LOWMEMORY | Not enough memory to complete operation.
3 | TWCC_NODS | Source Manager unable to find the specified Source.
4 | TWCC_MAXCONNECTIONS | Source is connected to maximum supported number of applications.
5 | TWCC_OPERATIONERROR | Source or Source Manager reported an error to the user and handled the error; no application action required.
6 | TWCC_BADCAP | Capability not supported by Source.
9 | TWCC_BADPROTOCOL | Unrecognized operation triplet.
10 | TWCC_BADVALUE | Data parameter out of supported range.
11 | TWCC_SEQERROR | Illegal operation for current Source Manager or Source state.
12 | TWCC_BADDEST | Unknown destination in DSM_Entry.
13 | TWCC_CAPUNSUPPORTED | Capability not supported by Source.
14 | TWCC_CAPBADOPERATION | Operation not supported on capability.
15 | TWCC_CAPSEQERROR | Capability has dependencies on other capabilities and cannot be operated upon at this time.
16 | TWCC_DENIED | File System operation is denied (file is protected).
17 | TWCC_FILEEXISTS | Operation failed because file already exists.
18 | TWCC_FILENOTFOUND | File not found.
19 | TWCC_NOTEMPTY | Operation failed because directory is not empty.
20 | TWCC_PAPERJAM | Transfer failed because of a feeder error.
21 | TWCC_PAPERDOUBLEFEED | Transfer failed because of a feeder error.
22 | TWCC_FILEWRITEERROR | Error writing the file.
23 | TWCC_CHECKDEVICEONLINE | The device went off-line prior to or during this operation.

See Also

OpenSession Method | CapSupported Property


See Also

TwainPro Members

See Also Pegasus Imaging TwainPro Control 5.0 Send comments on this topic.

TwainPro Object

Description

TwainPro Class

For a list of all members defined in this module, see TwainPro members.

See Also

TwainPro Members


TwainPro Overview

TwainPro Object Members

Public Methods

Public Method AboutBox | Displays an "about box" describing the control and displaying pertinent information.
Public Method CancelPendingXfers | Moves the Data Source from the Image Transfer state to the Capability Negotiation state. (Before StartSession is called)
Public Method CloseSession | Disables and closes the current data source and Data Source Manager.
Public Method CopyToClipboard | Copies the current image to the clipboard.
Public Method CutToClipboard | Cuts the current image to the clipboard.
Public Method DisplayUI | Displays the user interface.
Public Method GetExtInfo | Gets the Extended Image Info, such as barcode and patch code data, for the current page.
Public Method GetImageLayout | Gets the Left, Top, Right, and Bottom sides of the Image Layout rectangle for the current Data Source.
Public Method LoadSettings | Loads settings for the filename given.
Public Method OpenDSM | Opens the Source Manager.
Public Method OpenSession | Opens the Data Source Manager and Data Source, placing TwainPRO into the Capability Negotiation state.
Public Method SaveFile | Saves the current acquired DIB as a file given a path and file name.
Public Method SaveSettings | Saves settings for the filename given.
Public Method SelectSource | Displays the TWAIN Data Source Manager's Source Selection User Interface (UI) so the user can choose which Data Source is the current Source.
Public Method SetCapOut | Set the current capability using the container specified by CapTypeOut and the values in the various Cap Out properties.
Public Method SetDataSource | Selects a TWAIN Data Source from the DataSourceList property as the current Data Source.
Public Method SetImageLayout | Sets the Left, Top, Right, and Bottom sides of the Image Layout rectangle for the current Data Source.
Public Method StartSession | Enables the Current Data Source and places it into the Image Transfer state.
Public Method UnlockRuntime | Enables runtime licensing.
Public Method UnlockWeb | Enables web licensing when deploying to a web application.

Public Properties

Public Property Capability | Gets and sets which Twain capability to negotiate.
Public Property CapAdvanced | Gets or sets the advanced capabilities.
Public Property CapDefault | Gets the default value for a capability.
Public Property CapDesc | Gets or sets a description for the specified constant for the current capability.
Public Property CapExtInfoCount | Gets or sets the number of extended image information requested from a TWAIN Data Source that supports getting extended image information.
Public Property CapExtInfoIndex | Gets or sets the current position in the previously allocated extended image information array.
Public Property CapItem | Gets legal values for the specified capability.
Public Property CapItemOut | Sets a new legal value for a particular capability when CapType = TWCAP_ENUM or TWCAP_ARRAY.
Public Property CapItemString | Gets legal values for the specified capability.
Public Property CapMax | Gets the maximum value in a range when the CapType = TWCAP_RANGE.
Public Property CapMaxOut | Sets the maximum value in a range when CapTypeOut = TWCAP_RANGE.
Public Property CapMin | Gets the minimum value in a range when the CapType is TWCAP_RANGE.
Public Property CapMinOut | Gets the minimum value in a range when CapTypeOut = TWCAP_RANGE.
Public Property CapNumItems | The number of items in a list or array when CapType = TWCAP_ENUM or TWCAP_ARRAY.
Public Property CapNumItemsOut | Sets the number of items in a list or array when CapTypeOut = TWCAP_ENUM or TWCAP_ARRAY.
Public Property CapStep | Gets the step value in a range when the CapType is TWCAP_RANGE.
Public Property CapString | Gets the current string value for a capability.
Public Property CapStringOut | Sets the current string value for a capability.
Public Property CapSupported | Gets and sets whether the current capability is supported by the TWAIN device.
Public Property Caption | Gets and sets the text placed on a still frame.
Public Property CaptionHeight | Gets and sets the height in pixels of the clip rectangle used to write a caption to a frame during a frame capture.
Public Property CaptionLeft | Gets or sets the x or left offset in pixels to write the caption to a frame during a frame capture.
Public Property CaptionTop | Gets and sets the y or top offset in pixels to write the caption to a frame during a frame capture.
Public Property CaptionWidth | Gets and sets the width in pixels of the clip rectangle used to write a caption to a frame during a frame capture.
Public Property CapType | Gets the type of container used to transfer capability information from the Source.
Public Property CapTypeOut | Gets and sets the type of container used to transfer capability information to the Source.
Public Property CapValue | Gets the current value for a capability.
Public Property CapValueOut | Sets the current value for a capability.
Public Property ClipCaption | Gets and sets whether the Caption is clipped by the CaptionWidth and CaptionHeight properties or clipped using the right and bottom edges of the frame.
Public Property CloseOnCancel | Gets and sets whether the Twain User Interface should be closed when the operation is cancelled.
Public Property CurrentDataSource | Gets the index of the currently selected Data Source.
Public Property DataSourceCount | Gets the number of TWAIN Data Source product names.
Public Property DataSourceList | A string array of Data Source product names.
Public Property Debug | Gets or sets an indicator which determines if the component writes information to a DebugLogFile or not.
Public Property DebugErrorLevel | Gets or sets the error level of items that the component should write to the debug log file.
Public Property DebugLogFile | Gets or sets the filename of the debug log file.
Public Property EnableExtCaps | Gets and sets an indicator if the extended capabilities for feedpage and clearpage are enabled.
Public Property ErrorCode | Gets the extended error code returned by the Twain Source.
Public Property ErrorDescription | Gets a description of the extended error code returned by the Twain Source.
Public Property EvaluationMode | Gets and sets how the control will behave when in evaluation (non-licensed) mode.
Public Property Font | Gets and sets the font used to draw the Caption on the current still frame.
Public Property ForeColor | Gets and sets the color used to draw the Caption on the current still frame.
Public Property FTPPassword | Gets and sets the password used to log into an ftp site.
Public Property FTPUserName | Gets and sets the user name used to log into an ftp site.
Public Property HAlign | Gets and sets the horizontal alignment of the caption within the clipping rectangle.
Public Property hDIB | Gets the Window handle to the current DIB (Device Independent Bitmap).
Public Property hImage | Gets and sets the Window handle to the current compressed Image, either in TIFF or JPEG format.
Public Property hParentWnd | Gets and sets a window handle to the TwainPRO object for applications that create TwainPRO in-process rather than placing it on a form.
Public Property IBPP | Gets and sets the bits per pixel of the current image.
Public Property ICompression | Gets and sets the compression format of the current image.
Public Property IHeight | Gets the height of the current image.
Public Property IPixelType | Gets the pixel type of the current image.
Public Property IResX | Gets the X resolution of the current image.
Public Property IResY | Gets the Y resolution of the current image.
Public Property IWidth | Gets the width of the current image.
Public Property Manufacturer | Gets or sets the manufacturer string for the application identity.
Public Property MaxImages | Gets or sets the maximum number of images expected from a TWAIN Data Source that supports multiple image scanning.
Public Property PendingXfers | Gets and sets the number of image transfers the TWAIN Data Source is ready to supply to the TwainPRO control.
Public Property PICPassword | Gets or sets the password for an ePIC file.
Public Property Picture | Gets or sets a picture object containing a copy of the current frame buffer.
Public Property ProductFamily | Gets or sets the Product Family string for the application identity.
Public Property ProductName | Gets or sets the Product Name string for the application identity.
Public Property ProxyServer | Many organizations use a proxy server to allow individual computers to access the Internet through the local LAN.
Public Property RaiseExceptions | Gets and sets whether exceptions are raised.
Public Property SaveFileType | Gets and sets the type of file to save.
Public Property SaveIFDOffset | Gets and sets the location to append the next TIFF page when fast saving of multi-page TIFF files is invoked.
Public Property SaveJBIG2EncodeModeCompression | Gets and sets the encoding mode to use when creating JBIG2 compressed files.
Public Property SaveJBIG2FileOrgCompression | Gets and sets the file organization when saving a JBIG2 compressed file.
Public Property SaveJBIG2InvertedRegion | Gets and sets an indicator if the bits should be inverted prior to symbol analysis.
Public Property SaveJBIG2LoosenessCompression | Gets and sets how loose to be when matching symbols and compressing text using either of the lossy text region encode modes.
Public Property SaveJPEGChromFactor | Gets and sets the chrominance quality setting for saving JPEG and ePIC files.
Public Property SaveJPEGLumFactor | Gets and sets the luminance quality setting for saving JPEG and ePIC files.
Public Property SaveJPEGProgressive | Gets and sets whether JPEG or ePIC files are to be saved as standard files or progressive files.
Public Property SaveJPEGSubSampling | Gets and sets the desired sub-sampling.
Public Property SaveMultiPage | Gets and sets if a TIFF file should be saved as the next page in an existing file.
Public Property SavePDFCompression | Gets and sets the compression type for saving a PDF file.
Public Property SavePDFSwapBlackAndWhite | Gets and sets an indicator if the pixel value of zero is set to black or white.
Public Property SaveTIFFCompression | Gets and sets the TIFF compression type for saving a TIFF file.
Public Property SaveUseIFDOffset | Gets and sets an indicator to enable fast multi-page TIFF writes.
Public Property ShadowText | Gets and sets if a drop shadow should be placed under the caption.
Public Property ShowUI | Gets or sets whether the TWAIN data source displays its user interface when invoking the StartSession method.
Public Property TransferMode | Gets or sets the transfer mode for scanning.
Public Property TwainConditionCode | Gets additional TWAIN error information from the data source.
Public Property TwainConditionDescription | Gets the TWAIN error information description from the data source.
Public Property VAlign | Gets and sets the vertical alignment of the caption within the clipping rectangle.
Public Property VersionInfo | Gets or sets the version information string for the application identity.

Events

Public Event PostScan | Raised after a scan or transfer ends.
Public Event PreScan | Raised before a scan or transfer begins.

See Also

TwainPro Overview


TwainPro Object

AboutBox Method

Description

Displays an "about box" describing the control and displaying pertinent information.

Syntax

Public Sub AboutBox()

Remarks

This is the same as what is displayed at design time when the "..." button in the Properties window is clicked.

See Also

TwainPro Object


TwainPro Object | PendingXfers Property

CancelPendingXfers Method

Description

Moves the Data Source from the Image Transfer state to the Capability Negotiation state. (Before StartSession is called)

Syntax

Public Sub CancelPendingXfers()

Remarks

All remaining image data from the Data Source is released and the PendingXfers property is set to zero. This method may only be used while the Data Source is in the Image Transfer state, otherwise an error is generated.

See Also

TwainPro Object | PendingXfers Property


TwainPro Object | StartSession Method | OpenSession Method | OpenDSM Method

See Also Pegasus Imaging TwainPro Control 5.0 Send comments on this topic.

CloseSession Method

Description

Disables and closes the current data source and Data Source Manager.

Syntax

Public Sub CloseSession()

Remarks

For every OpenSession or OpenDSM (Data Source Manager) method call, you need to close the TwainPRO session with CloseSession. This method cancels any pending image transfers, if the data source was in the image transfer state. It is not necessary to call CloseSession after StartSession, as this method calls it internally before returning.

See Also

TwainPro Object | StartSession Method | OpenSession Method | OpenDSM Method


TwainPro Object | SaveFile Method | hDIB Property

CopyToClipboard Method

Description

Copies the current image to the clipboard.

Syntax

Public Sub CopyToClipboard()

Remarks

This method makes a copy of the current image and places it on the clipboard. This will leave the hDIB property valid for operations such as the SaveFile method, but will leave two copies of the image in memory which could be a problem if the image is very large.

See Also

TwainPro Object | SaveFile Method | hDIB Property


TwainPro Object | hDIB Property | SaveFile Method

CutToClipboard Method

Description

Cuts the current image to the clipboard.

Syntax

Public Sub CutToClipboard()

Remarks

This method places the current image on the clipboard. The hDIB property will not be valid after this operation. If you wish to save the image to file, the SaveFile method must be invoked prior to the CutToClipboard method.

See Also

TwainPro Object | hDIB Property | SaveFile Method


TwainPro Object

DisplayUI Method

Description

Displays the user interface.

Syntax

Public Sub DisplayUI()

Remarks

Displays the Data Source's User Interface so the user can manipulate scanner settings but not acquire an image at this time.

See Also

TwainPro Object


TwainPro Object | CapExtInfoCount Property | CapExtInfoIndex Property | CapAdvanced Property | Access Extended Image Information

See Also Pegasus Imaging TwainPro Control 5.0 Send comments on this topic.

GetExtInfo Method

Description

Gets the Extended Image Info, such as barcode and patch code data, for the current page.

Syntax

Public Sub GetExtInfo()

Remarks

This method fills in the extended image information array previously allocated and initialized using the CapExtInfoCount, CapExtInfoIndex, and CapAdvanced properties.

Call this method only during the PostScan event.

See the section entitled Accessing Extended Image Information for more information.

See Also

TwainPro Object | CapExtInfoCount Property | CapExtInfoIndex Property | CapAdvanced Property | Access Extended Image Information


GetImageLayout Method

TwainPro Object | StartSession Method | OpenSession Method

ImageLeft
Floating point number for the Left side of the Image Layout rectangle.
ImageTop
Floating point number for the Top side of the Image Layout rectangle.
ImageRight
Floating point number for the Right side of the Image Layout rectangle.
ImageBottom
Floating point number for the Bottom side of the Image Layout rectangle.
See Also Pegasus Imaging TwainPro Control 5.0 Send comments on this topic.

GetImageLayout Method

Description

Gets the Left, Top, Right, and Bottom sides of the Image Layout rectangle for the current Data Source.

Syntax

Public Sub GetImageLayout( _
   ByRef ImageLeft As Single, _
   Optional ByRef ImageTop As Variant, _
   Optional ByRef ImageRight As Variant, _
   Optional ByRef ImageBottom As Variant _
)

Parameters

ImageLeft
Floating point number for the Left side of the Image Layout rectangle.
ImageTop
Floating point number for the Top side of the Image Layout rectangle.
ImageRight
Floating point number for the Right side of the Image Layout rectangle.
ImageBottom
Floating point number for the Bottom side of the Image Layout rectangle.

Remarks

The Image Layout rectangle defines what portion of the Data Source's scanning area is acquired.

Call this method after OpenSession and before StartSession.

See Also

TwainPro Object | StartSession Method | OpenSession Method


TwainPro Object | SaveSettings Method | Debug Property

FileName
A string value which represents the filename to load options for.
See Also Pegasus Imaging TwainPro Control 5.0 Send comments on this topic.

LoadSettings Method

Description

Loads settings for the filename given.

Syntax

Public Sub LoadSettings( _
   ByVal FileName As String _
)

Parameters

FileName
A string value which represents the filename to load options for.

Remarks

Loads scanner settings that were previously saved to a file using the SaveSettings method.

Note: Your scanner may not support setting all of the capabilities that are saved in the settings file. If you set the Debug property to True to write a Debug Log File, then during the LoadSettings operation all unsupported capabilities are written to the DebugLogFile.

See Also

TwainPro Object | SaveSettings Method | Debug Property


TwainPro Object

OpenDSM Method

Description

Opens the Source Manager.

Syntax

Public Sub OpenDSM()

Remarks

Use this method only to set the Data Source without using the SelectSource method. Use this method to set the DataSourceList and DataSourceCount properties. Then use a value from this list in the SetDataSource method before calling OpenSession.

See Also

TwainPro Object


TwainPro Object | CloseSession Method

OpenSession Method

Description

Opens the Data Source Manager and Data Source, placing TwainPRO into the Capability Negotiation state.

Syntax

Public Sub OpenSession()

Remarks

Use this method for controlling the Data Source capabilities and Data Source UI. This Method is used in conjunction with CloseSession and the capability negotiation methods.

See Also

TwainPro Object | CloseSession Method


TwainPro Object | FTPUserName Property | SaveFileType Property | TP_SaveFileType Enumeration

FileName
A string representation of a legal file name (path) to which the file will be saved.
See Also Pegasus Imaging TwainPro Control 5.0 Send comments on this topic.

SaveFile Method

Description

Saves the current acquired DIB as a file given a path and file name.

Syntax

Public Sub SaveFile( _
   ByVal FileName As String _
)

Parameters

FileName
A string representation of a legal file name (path) to which the file will be saved.

Remarks

A valid FTP address can also be specified for the path, provided the FTPUserName and FTPPassword properties are set appropriately for the ftp server specified in the path. The bitmap saved will be the same bits per pixel and color depth as the current DIB.

This method can be used to specify the format of the file. If the SaveFileType property is set to TP_SaveFileType_Default, one of the following valid file extensions need to be used: .bmp, .jpg, .pic, .tif., and .pdf.

See Also

TwainPro Object | FTPUserName Property | SaveFileType Property | TP_SaveFileType Enumeration


TwainPro Object | LoadSettings Method | Debug Property | DebugLogFile Property

FileName
A string value which represents the filename to save options for.
See Also Pegasus Imaging TwainPro Control 5.0 Send comments on this topic.

SaveSettings Method

Description

Saves settings for the filename given.

Syntax

Public Sub SaveSettings( _
   ByVal FileName As String _
)

Parameters

FileName
A string value which represents the filename to save options for.

Remarks

This method will save the settings of all settable, documented capabilities to file. A settings file contains settings for one TWAIN device, and settings for other TWAIN devices will need to be saved to separate settings files.

The LoadSettings method can be used to later load the settings from file.

Note: Your scanner might not support setting all of the capabilities that are saved in the settings file. If you set the Debug property to True to write a Debug Log File, then during the LoadSettings operation all unsupported capabilities will be written to the Debug Log File.

See Also

TwainPro Object | LoadSettings Method | Debug Property | DebugLogFile Property


TwainPro Object

SelectSource Method

Description

Displays the TWAIN Data Source Manager's Source Selection User Interface (UI) so the user can choose which Data Source is the current Source.

Syntax

Public Sub SelectSource()

Remarks

This method closes previously opened TwainPRO sessions.

See Also

TwainPro Object


TwainPro Object | CapTypeOut Property | TP_CapType Enumeration

See Also Pegasus Imaging TwainPro Control 5.0 Send comments on this topic.

SetCapOut Method

Description

Set the current capability using the container specified by CapTypeOut and the values in the various Cap Out properties.

Syntax

Public Sub SetCapOut()

Remarks

All properties for a particular container must be set before invoking this method. If only the current value is to be set, be sure to use the TWON_ONEVALUE container.

See Also

TwainPro Object | CapTypeOut Property | TP_CapType Enumeration


TwainPro Object | DataSourceList Property | OpenDSM Method

Index
A long value which represents a zero-based index which matches the data source.
See Also Pegasus Imaging TwainPro Control 5.0 Send comments on this topic.

SetDataSource Method

Description

Selects a TWAIN Data Source from the DataSourceList property as the current Data Source.

Syntax

Public Sub SetDataSource( _
   ByVal Index As Long _
)

Parameters

Index
A long value which represents a zero-based index which matches the data source.

Remarks

The method OpenDSM must be called before this method. Use the property DataSourceCount to determine how many Data Sources are on the current system.

See Also

TwainPro Object | DataSourceList Property | OpenDSM Method


SetImageLayout Method

TwainPro Object | OpenSession Method

ImageLeft
Floating point number for the Left side of the Image Layout rectangle
ImageTop
Floating point number for the Top side of the Image Layout rectangle
ImageRight
Floating point number for the Right side of the Image Layout rectangle
ImageBottom
Floating point number for the Bottom side of the Image Layout rectangle
See Also Pegasus Imaging TwainPro Control 5.0 Send comments on this topic.

SetImageLayout Method

Description

Sets the Left, Top, Right, and Bottom sides of the Image Layout rectangle for the current Data Source.

Syntax

Public Sub SetImageLayout( _
   ByVal ImageLeft As Single, _
   Optional ByVal ImageTop As Variant, _
   Optional ByVal ImageRight As Variant, _
   Optional ByVal ImageBottom As Variant _
)

Parameters

ImageLeft
Floating point number for the Left side of the Image Layout rectangle
ImageTop
Floating point number for the Top side of the Image Layout rectangle
ImageRight
Floating point number for the Right side of the Image Layout rectangle
ImageBottom
Floating point number for the Bottom side of the Image Layout rectangle

Remarks

The Image Layout rectangle defines what portion of the Data Source's scanning area is acquired.

Call this method after OpenSession and before StartSession.

See Also

TwainPro Object | OpenSession Method


TwainPro Object | ShowUI Property | OpenSession Method

StartSession Method

Description

Enables the Current Data Source and places it into the Image Transfer state.

Syntax

Public Sub StartSession()

Remarks

Displays the Data Source User Interface if ShowUI is True. This method will return when the user closes the UI if the ShowUI property is True or after the image transfer if ShowUI is False. It is not necessary to call OpenSession before calling this method. All Capability Negotiation methods must be called before this method.

See Also

TwainPro Object | ShowUI Property | OpenSession Method


UnlockRuntime Method

TwainPro Object | Runtime Licensing

PW0
A string which represents a unique licensing code, provided by Pegasus Imaging when runtime licenses are purchased.
PW1
string which represents a unique licensing code, provided by Pegasus Imaging when runtime licenses are purchased.
PW2
string which represents a unique licensing code, provided by Pegasus Imaging when runtime licenses are purchased.
PW3
string which represents a unique licensing code, provided by Pegasus Imaging when runtime licenses are purchased.
See Also Pegasus Imaging TwainPro Control 5.0 Send comments on this topic.

UnlockRuntime Method

Description

Enables runtime licensing.

Syntax

Public Sub UnlockRuntime( _
   ByVal PW0 As Long, _
   ByVal PW1 As Long, _
   ByVal PW2 As Long, _
   ByVal PW3 As Long _
)

Parameters

PW0
A string which represents a unique licensing code, provided by Pegasus Imaging when runtime licenses are purchased.
PW1
string which represents a unique licensing code, provided by Pegasus Imaging when runtime licenses are purchased.
PW2
string which represents a unique licensing code, provided by Pegasus Imaging when runtime licenses are purchased.
PW3
string which represents a unique licensing code, provided by Pegasus Imaging when runtime licenses are purchased.

Remarks

See Also

TwainPro Object | Runtime Licensing


TwainPro Object

url
A string which represents the URL (uniform resource locator) for the web application.
See Also Pegasus Imaging TwainPro Control 5.0 Send comments on this topic.

UnlockWeb Method

Description

Enables web licensing when deploying to a web application.

Syntax

Public Sub UnlockWeb( _
   ByVal url As String _
)

Parameters

url
A string which represents the URL (uniform resource locator) for the web application.

Remarks

Call this method when the application begins to enable runtime use of the control in a web application.

See Also

TwainPro Object


TwainPro Object | TP_Capability Enumeration

Capability Property

Description

Gets and sets which Twain capability to negotiate.

Property type

Read-write property

Syntax (Visual Basic)

Public Property Capability() As TP_Capability

Return Type

A TP_Capability enumeration value which determines the Twain capability.

Remarks

This is a runtime-only property. There are no properties or methods unique to a capability such as SetBrightness. All capabilities use the same set of methods to negotiate their values.

Example

TwainPRO1.Capability = TWCAP_BRIGHTNESS

TwainPRO1.CapTypeOut = TWCAP_ONEVALUE

TwainPRO1.CapValueOut = 500

TwainPRO1.SetCapOut

See Also

TwainPro Object | TP_Capability Enumeration


TwainPro Object

CapAdvanced Property

Description

Gets or sets the advanced capabilities.

Property type

Read-write property

Syntax (Visual Basic)

Public Property CapAdvanced() As Long

Return Type

A long value which represents the advanced capabilities.

Remarks

Specifies which Twain capability to negotiate. It is also used to set which extended image information is to be requested. This is a runtime-only property.

This property should be used only when a capability that is not directly supported by the Capability property is needed. This property is ignored unless the Capability property has been set to either TWCAP_USECAPADVANCED or TW_CAPUSECAPADVANCEDFOREXTINFO. All capability functions are available except the CapDesc property when the Capability property is set to TWCAP_USECAPADVANCED. When the Capability is set to TWCAP_USECAPADVANCEDFOREXTINFO then neither CapDesc or any of the capability out properties such as CapValueOut are available.

See the section for accessing Extended Image Information when the Capability property is set to TW_CAPUSECAPADVANCEDFOREXTINFO.

See Also

TwainPro Object


TwainPro Object

CapDefault Property

Description

Gets the default value for a capability.

Property type

Read-write property

Syntax (Visual Basic)

Public Property CapDefault() As Single

Return Type

A single value which represents the default value for a capability.

Remarks

This is a runtime, read-only property.

The default value can only be read, therefore, there is no corresponding property to set the default value.

See Also

TwainPro Object


TwainPro Object

Index
A long value which represents the zero-based index value of the item.
See Also Pegasus Imaging TwainPro Control 5.0 Send comments on this topic.

CapDesc Property

Description

Gets or sets a description for the specified constant for the current capability.

Property type

Read-write property

Syntax (Visual Basic)

Public Property CapDesc( _
   ByVal Index As Long _
) As String

Parameters

Index
A long value which represents the zero-based index value of the item.

Return Type

A string value which represents the description for the specified constant for the current capability.

Remarks

This is a runtime, read-only property.

When CapType = TWCAP_ENUM, the Source may return a list of constants that signify settings.

For example, if Capability = TWCAP_PIXELTYPE, and the Source returns a TWCAP_ENUM containing the constants, TWPT_BW (0), TWPT_GRAY (1), TWPT_RGB (2) a description of each may be obtained with the CapDesc property.

TwainPRO.CapDesc( TWPT_BW ) would return "Black & White". This can be used for filling a listbox or combobox with descriptions of available values instead of just the constants.

See Also

TwainPro Object


TwainPro Object

CapExtInfoCount Property

Description

Gets or sets the number of extended image information requested from a TWAIN Data Source that supports getting extended image information.

Property type

Read-write property

Syntax (Visual Basic)

Public Property CapExtInfoCount() As Long

Return Type

A long value which represents the number of extended image information requested from a TWAIN data source.

Remarks

The default value is 0.

This property allocates an array to step through to setup the extended information requested. This property should be setup prior to scanning.

See Also

TwainPro Object


TwainPro Object

CapExtInfoIndex Property

Description

Gets or sets the current position in the previously allocated extended image information array.

Property type

Read-write property

Syntax (Visual Basic)

Public Property CapExtInfoIndex() As Long

Return Type

A long value which represents the current position in the previous array.

Remarks

The default value is 0.

Call this property after the CapExtInfoCount has been set. Use this property to move through the extended image information array.

See Also

TwainPro Object


TwainPro Object

Index
A long zero-based value which represents the capability.
See Also Pegasus Imaging TwainPro Control 5.0 Send comments on this topic.

CapItem Property

Description

Gets legal values for the specified capability.

Property type

Read-write property

Syntax (Visual Basic)

Public Property CapItem( _
   ByVal Index As Long _
) As Single

Parameters

Index
A long zero-based value which represents the capability.

Return Type

A single value which represents legal values for a specified capability.

Remarks

An array of floating point numbers specifying legal values for a particular capability when CapType = TWCAP_ENUM or TWCAP_ARRAY.

Use this property only for reading a value. Use the CapItemOut property and SetCapOut method to set a new value.

See Also

TwainPro Object


TwainPro Object

Index
A long zero-based value representing the capability item.
See Also Pegasus Imaging TwainPro Control 5.0 Send comments on this topic.

CapItemOut Property

Description

Sets a new legal value for a particular capability when CapType = TWCAP_ENUM or TWCAP_ARRAY.

Property type

Read-write property

Syntax (Visual Basic)

Public Property CapItemOut( _
   ByVal Index As Long _
) As Single

Parameters

Index
A long zero-based value representing the capability item.

Return Type

A single value which represents the new legal value for the given capability.

Remarks

Use this property only for setting a capability. Use the CapItem property to read the current capability values.

After setting this property, invoke the SetCapOut method to actually set the values.

Note: This property can only be set if CapTypeOut = TWCAP_ENUM or TWCAP_ARRAY, otherwise an error is generated.

See Also

TwainPro Object


TwainPro Object

Index
A zero-based long value which represents the specified capability to get the string of.
See Also Pegasus Imaging TwainPro Control 5.0 Send comments on this topic.

CapItemString Property

Description

Gets legal values for the specified capability.

Property type

Read-write property

Syntax (Visual Basic)

Public Property CapItemString( _
   ByVal Index As Long _
) As String

Parameters

Index
A zero-based long value which represents the specified capability to get the string of.

Return Type

A string value which represents legal values for the given capability.

Remarks

Use this property only for reading a string value.

See Also

TwainPro Object


TwainPro Object

CapMax Property

Description

Gets the maximum value in a range when the CapType = TWCAP_RANGE.

Property type

Read-write property

Syntax (Visual Basic)

Public Property CapMax() As Single

Return Type

A single value which represents the maximum value in a range.

Remarks

Use this property only for reading a value. Use the CapMaxOut property and SetCapOut method to set a new value.

See Also

TwainPro Object


TwainPro Object

CapMaxOut Property

Description

Sets the maximum value in a range when CapTypeOut = TWCAP_RANGE.

Property type

Read-write property

Syntax (Visual Basic)

Public Property CapMaxOut() As Single

Return Type

A single value which represents the maximum value in a range.

Remarks

This is a runtime-only property.

Use this property only for setting a value. Use the CapMax property to read the current maximum value.

After setting this property, invoke the SetCapOut method to actually set the value.

This property can only be set if CapTypeOut = TWCAP_RANGE, otherwise an error is generated.

See Also

TwainPro Object


TwainPro Object

CapMin Property

Description

Gets the minimum value in a range when the CapType is TWCAP_RANGE.

Property type

Read-write property

Syntax (Visual Basic)

Public Property CapMin() As Single

Return Type

A single value which represents the minimum value in a range.

Remarks

This is a runtime, read-only property. Use this property only for reading a value. Use the CapMinOut property and SetCapOut method to set a new value.

See Also

TwainPro Object


TwainPro Object

CapMinOut Property

Description

Gets the minimum value in a range when CapTypeOut = TWCAP_RANGE.

Property type

Read-write property

Syntax (Visual Basic)

Public Property CapMinOut() As Single

Return Type

A single value which represents the minimum value in a range.

Remarks

Use this property only for setting a value. Use the CapMin property to read the current minimum value.

After setting this property, invoke the SetCapOut method to actually set the value.

Note: This property can only be set if CapTypeOut = TWCAP_RANGE, otherwise an error is generated.

See Also

TwainPro Object


TwainPro Object

CapNumItems Property

Description

The number of items in a list or array when CapType = TWCAP_ENUM or TWCAP_ARRAY.

Property type

Read-write property

Syntax (Visual Basic)

Public Property CapNumItems() As Long

Return Type

A long value which represents the number of items in a list or array for the capability.

Remarks

This is a runtime, read-only property.

Use this property only for reading a value. Use the CapNumItemsOut property and SetCapOut method to set a new value.

See Also

TwainPro Object


TwainPro Object

CapNumItemsOut Property

Description

Sets the number of items in a list or array when CapTypeOut = TWCAP_ENUM or TWCAP_ARRAY.

Property type

Read-write property

Syntax (Visual Basic)

Public Property CapNumItemsOut() As Long

Return Type

A long value which represents the number of items in a list or array for a capability.

Remarks

This is a runtime-only property.

Use this property only for setting a capability. Use the CapNumItems property to read the current capability.

After setting this property, invoke the SetCapOut method to actually set the values.

This property can only be set if CapTypeOut = TWCAP_ENUM or TWCAP_ARRAY, otherwise an error is generated.

See Also

TwainPro Object


TwainPro Object

CapStep Property

Description

Gets the step value in a range when the CapType is TWCAP_RANGE.

Property type

Read-write property

Syntax (Visual Basic)

Public Property CapStep() As Single

Return Type

A single value which represents the step value in a range.

Remarks

This is a runtime, read-only property.

This is the increment the Twain device prefers when setting a new value. For example, if Capability = TWCAP_XRESOLUTION, CapMin = 100, CapMax = 600 and CapStep = 100, then a legal new value would be in the range of 100 - 600 in increments of 100.

If a non-step aligned value is set to the Capability, no error is generated, and the Twain device will most likely round to the nearest step.

The step value can only be read, therefore, there is no corresponding property to set the step value.

See Also

TwainPro Object


TwainPro Object

CapString Property

Description

Gets the current string value for a capability.

Property type

Read-write property

Syntax (Visual Basic)

Public Property CapString() As String

Return Type

A string value which represents the current string for a capability.

Remarks

Use this property only for reading a capability’s string value.

See Also

TwainPro Object


TwainPro Object

CapStringOut Property

Description

Sets the current string value for a capability.

Property type

Read-write property

Syntax (Visual Basic)

Public Property CapStringOut() As String

Return Type

A string value which represents a capability.

See Also

TwainPro Object


TwainPro Object

CapSupported Property

Description

Gets and sets whether the current capability is supported by the TWAIN device.

Property type

Read-write property

Syntax (Visual Basic)

Public Property CapSupported() As Boolean

Return Type

A boolean value which is True if the current capability is supported. Otherwise, False is used and the current capability is not supported.

Remarks

This property should be checked before reading other properties such as CapValue. Attempting to read values for a capability that isn't supported will generate an error.

See Also

TwainPro Object


TwainPro Object

Caption Property

Description

Gets and sets the text placed on a still frame.

Property type

Read-write property

Syntax (Visual Basic)

Public Property Caption() As String

Return Type

A string value which represents the text placed on a still frame.

See Also

TwainPro Object


TwainPro Object

CaptionHeight Property

Description

Gets and sets the height in pixels of the clip rectangle used to write a caption to a frame during a frame capture.

Property type

Read-write property

Syntax (Visual Basic)

Public Property CaptionHeight() As Long

Return Type

A long value which represents the height of the clip rectangle used to write a caption to a frame during a frame capture.

Remarks

This property is ignored if the ClipCaption property is set to False, and the bottom edge of the frame is used as a boundary.

See Also

TwainPro Object


TwainPro Object

CaptionLeft Property

Description

Gets or sets the x or left offset in pixels to write the caption to a frame during a frame capture.

Property type

Read-write property

Syntax (Visual Basic)

Public Property CaptionLeft() As Long

Return Type

A long value which represents the left offset in pixels to write the caption to a frame during a frame capture.

See Also

TwainPro Object


TwainPro Object

CaptionTop Property

Description

Gets and sets the y or top offset in pixels to write the caption to a frame during a frame capture.

Property type

Read-write property

Syntax (Visual Basic)

Public Property CaptionTop() As Long

Return Type

A long value which represents the top offset in pixels to write the caption to a frame during a frame capture.

See Also

TwainPro Object


TwainPro Object

CaptionWidth Property

Description

Gets and sets the width in pixels of the clip rectangle used to write a caption to a frame during a frame capture.

Property type

Read-write property

Syntax (Visual Basic)

Public Property CaptionWidth() As Long

Return Type

A long value which represents the width in pixels of the clip rectangle.

Remarks

This property is ignored if the ClipCaption property is set to False, and the right edge of the frame is used as a boundary.

See Also

TwainPro Object


TwainPro Object

CapType Property

Description

Gets the type of container used to transfer capability information from the Source.

Property type

Read-write property

Syntax (Visual Basic)

Public Property CapType() As TP_CapType

Return Type

A TP_CapType enumeration value which determines the type of container used to transfer capability information from the source.

Remarks

This is a runtime, read-only property.

There are four values TWAIN uses to transfer data from the Source. This determines which TwainPRO properties access the capability information.

See Also

TwainPro Object


TwainPro Object

CapTypeOut Property

Description

Gets and sets the type of container used to transfer capability information to the Source.

Property type

Read-write property

Syntax (Visual Basic)

Public Property CapTypeOut() As TP_CapType

Return Type

A TP_CapType enumeration value which determines the type of container used to transfer capability information to the source.

Remarks

This is a runtime-only property.

There are four values Twain uses to transfer data to the Source. This determines which TwainPRO properties set the capability information.

See Also

TwainPro Object


TwainPro Object

CapValue Property

Description

Gets the current value for a capability.

Property type

Read-write property

Syntax (Visual Basic)

Public Property CapValue() As Single

Return Type

A single value which represents the value for a capability.

Remarks

This is a runtime, read-only property.

Use this property only for reading a value. Use the CapValueOut property and SetCapOut method to set a new value.

See Also

TwainPro Object


TwainPro Object

CapValueOut Property

Description

Sets the current value for a capability.

Property type

Read-write property

Syntax (Visual Basic)

Public Property CapValueOut() As Single

Return Type

A single value which represents the current value for a capability to set.

Remarks

This is a runtime-only property.

Use this property only for setting a value.

Use the CapValue property to read the current value.

After setting this property, invoke the SetCapOut method to actually set the value.

This property can not be set if CapTypeOut = TWCAP_ARRAY or an error will be generated.

See Also

TwainPro Object


TwainPro Object

ClipCaption Property

Description

Gets and sets whether the Caption is clipped by the CaptionWidth and CaptionHeight properties or clipped using the right and bottom edges of the frame.

Property type

Read-write property

Syntax (Visual Basic)

Public Property ClipCaption() As Boolean

Return Type

A boolean value which is True if the Caption is clipped by the CaptionWidth and CaptionHeight properties. Otherwise, False is used and the Caption is clipped using the right and bottom edges of the frame.

Remarks

This property has no effect on the CaptionLeft and CaptionTop properties which are always used to determine the placement of the caption.

See Also

TwainPro Object


TwainPro Object

CloseOnCancel Property

Description

Gets and sets whether the Twain User Interface should be closed when the operation is cancelled.

Property type

Read-write property

Syntax (Visual Basic)

Public Property CloseOnCancel() As Boolean

Return Type

A boolean value which is True when the User Interface is closed when the user issues a cancel. Otherwise, False is used and the User Interface is not closed when the user issues a cancel.

Remarks

If the Twain User Interface is shown, the CloseOnCancel property determines whether the User Interface will be closed when the user issues a cancel.

See Also

TwainPro Object


TwainPro Object

CurrentDataSource Property

Description

Gets the index of the currently selected Data Source.

Property type

Read-write property

Syntax (Visual Basic)

Public Property CurrentDataSource() As Long

Return Type

A long value which represents the zero-based index of the currently selected data source.

Remarks

This index corresponds to the list of Data Sources returned in the DataSourceList property.

This is a runtime, read-only property.

Invoke the OpenDSM method before accessing this property.

See Also

TwainPro Object


TwainPro Object

DataSourceCount Property

Description

Gets the number of TWAIN Data Source product names.

Property type

Read-write property

Syntax (Visual Basic)

Public Property DataSourceCount() As Long

Return Type

A long value which represents the number of TWAIN data source product names.

Remarks

This property is set by invoking the OpenDSM method. This is a runtime, read-only property. Use this property when building your own list of Data Sources, instead of using the SelectSource method to bring up the default selection dialog.

See Also

TwainPro Object


TwainPro Object

Index
A long value which represents characters representing the item.
See Also Pegasus Imaging TwainPro Control 5.0 Send comments on this topic.

DataSourceList Property

Description

A string array of Data Source product names.

Property type

Read-write property

Syntax (Visual Basic)

Public Property DataSourceList( _
   ByVal Index As Long _
) As String

Parameters

Index
A long value which represents characters representing the item.

Return Type

A string which represents a list of data source product names.

Remarks

DataSourceList is set by calling the OpenDSM method.

This is a runtime, read-only property.

DataSourceList contains all of the Data Source product names installed on the current Windows system. Each string is no longer than 32 characters.

See Also

TwainPro Object


TwainPro Object

Debug Property

Description

Gets or sets an indicator which determines if the component writes information to a DebugLogFile or not.

Property type

Read-write property

Syntax (Visual Basic)

Public Property Debug() As Boolean

Return Type

A boolean value which is True if the component writes data to a debug log file. Otherwise, False is returned.

Remarks

The default value is False.

This property allows you to turn the debug log file on or off without changing any of the other debug settings. When this value is true, the component will write items to the debug log file, as specified by the DebugLogFile and DebugErrorLevel properties.

See Also

TwainPro Object


TwainPro Object

DebugErrorLevel Property

Description

Gets or sets the error level of items that the component should write to the debug log file.

Property type

Read-write property

Syntax (Visual Basic)

Public Property DebugErrorLevel() As TP_DebugErrorLevel

Return Type

The TP_DebugErrorLevel enumeration value set.

Remarks

The default value is Production.

Valid values are Production, Development, and Detailed.

This property allows you to control the amount of information that the component places into the DebugLogFile. Since it is expensive to generate and write debug log items, set this property to write the least amount of information that you will find useful.

Note: This property has no effect if the Debug property is set to false.

See Also

TwainPro Object


TwainPro Object

DebugLogFile Property

Description

Gets or sets the filename of the debug log file.

Property type

Read-write property

Syntax (Visual Basic)

Public Property DebugLogFile() As String

Return Type

A string value which represents the full path and name of the debug log file.

Remarks

The default value is "Temp\TwainPro5.log".

Valid values are any valid filename.

This property allows you to control the location of the debug log file.

Note: This property will have no effect if you set the Debug property to false.

See Also

TwainPro Object


TwainPro Object

EnableExtCaps Property

Description

Gets and sets an indicator if the extended capabilities for feedpage and clearpage are enabled.

Property type

Read-write property

Syntax (Visual Basic)

Public Property EnableExtCaps() As Boolean

Return Type

A boolean value which is True if the extended capabilities are enabled. Otherwise, False is used.

See Also

TwainPro Object


TwainPro Object

ErrorCode Property

Description

Gets the extended error code returned by the Twain Source.

Property type

Read-write property

Syntax (Visual Basic)

Public Property ErrorCode() As Long

Return Type

A long value which represents the error code.

Remarks

This is a runtime, read-only property.

This property is valid if TwainPRO returns error code TWERR_TWAIN (1000) which indicates that the Source returned extended information.

See Also

TwainPro Object


TwainPro Object

ErrorDescription Property

Description

Gets a description of the extended error code returned by the Twain Source.

Property type

Read-write property

Syntax (Visual Basic)

Public Property ErrorDescription() As String

Return Type

A string value which represents the error description.

Remarks

This is a runtime, read-only property.

This property is valid if TwainPRO returns error code TWERR_TWAIN (1000) which indicates that the Source returned extended information.

See Also

TwainPro Object


TwainPro Object

EvaluationMode Property

Description

Gets and sets how the control will behave when in evaluation (non-licensed) mode.

Property type

Read-write property

Syntax (Visual Basic)

Public Property EvaluationMode() As TP_EvaluationMode

Return Type

A TP_EvaluationMode enumeration value which determines how the control behaves in evaluation mode.

Remarks

The default value is Automatic.

If Windows desktop is not available (e.g. in an NT Service), the control switches to EVAL_Timeout mode. If the desktop is not available and cannot be detected, the control hangs. In this case, you must use EVAL_Timeout mode.

To run in regular (not evaluation) mode, purchase and register a license .

See Also

TwainPro Object


TwainPro Object

Font Property

Description

Gets and sets the font used to draw the Caption on the current still frame.

Property type

Read-write property

Syntax (Visual Basic)

Public Property Font() As Font

Return Type

A Font value to draw the caption on the still frame.

Remarks

The default value is 8 point MS Sans Serif.

See Also

TwainPro Object


TwainPro Object

ForeColor Property

Description

Gets and sets the color used to draw the Caption on the current still frame.

Property type

Read-write property

Syntax (Visual Basic)

Public Property ForeColor() As ULong

Return Type

A ULong value which represents the color used to draw the caption.

Remarks

The default color is Black.

See Also

TwainPro Object


TwainPro Object

FTPPassword Property

Description

Gets and sets the password used to log into an ftp site.

Property type

Read-write property

Syntax (Visual Basic)

Public Property FTPPassword() As String

Return Type

A string value which represents the password.

Remarks

This is necessary only if an ftp address was specified in the SaveFile method.

See Also

TwainPro Object


TwainPro Object

FTPUserName Property

Description

Gets and sets the user name used to log into an ftp site.

Property type

Read-write property

Syntax (Visual Basic)

Public Property FTPUserName() As String

Return Type

A string value which represents the ftp user name.

Remarks

This is necessary only if an ftp address was specified in the SaveFile method.

See Also

TwainPro Object


TwainPro Object

HAlign Property

Description

Gets and sets the horizontal alignment of the caption within the clipping rectangle.

Property type

Read-write property

Syntax (Visual Basic)

Public Property HAlign() As TP_HorizontalAlignment

Return Type

A TP_HorizontalAlignment enumeration value which determines the horizontal alignment of the caption within the clipping rectangle.

Remarks

The clipping rectangle is determined by the ClipCaption and Caption rectangle properties.

See Also

TwainPro Object


TwainPro Object

hDIB Property

Description

Gets the Window handle to the current DIB (Device Independent Bitmap).

Property type

Read-write property

Syntax (Visual Basic)

Public Property hDIB() As Long

Return Type

A long value which represents the window handle to the current DIB.

Remarks

The StartSession method is used to scan a DIB into the control. If the hDIB value is 0, a bitmap does not exist. Use the hDIB property to copy the image data from the TwainPRO control to other image controls.

Example

After the assignment, the hDIB property is set to zero, so you must check it by assigning it to a temporary variable as illustrated below. The following example assigns the hDIB to an ImagXpress control:

Dim hDIB as long

hDIB = TwainPRO1.hDIB

if (hDIB <> 0) then

ImagXpress1.hDIB = hDIB

end if

See Also

TwainPro Object


TwainPro Object

hImage Property

Description

Gets and sets the Window handle to the current compressed Image, either in TIFF or JPEG format.

Property type

Read-write property

Syntax (Visual Basic)

Public Property hImage() As Long

Return Type

A long value which represents the window handle to the current compressed image in TIFF or JPEG format.

Remarks

After successfully negotiating to transfer the image in a compressed format from the scanner, the StartSession method is used to scan a compressed image into the control. If the hImage value is 0, a compressed image does not exist. Use the hImage property to copy the compressed image data from the TwainPRO control to other image controls.

Example

After the assignment, the hImage property is set to zero, so you must check it by assigning it to a temporary variable as illustrated below. The following example loads a compressed image to an ImagXpress control:

Dim hImage as long

If ( TwainPRO1.ICompression <> TWCP_NONE )

hImage = TwainPRO1.hImage

If (hImage <> 0) Then

ImagXpress1.LoadBuffer(hImage )

End If

End If

See Also

TwainPro Object


TwainPro Object

hParentWnd Property

Description

Gets and sets a window handle to the TwainPRO object for applications that create TwainPRO in-process rather than placing it on a form.

Property type

Read-write property

Syntax (Visual Basic)

Public Property hParentWnd() As Long

Return Type

A long value which represents a window handle to the TwainPRO object for applications that create TwainPRO in-process.

Remarks

This property has no effect if the object was created by placing on a form such as in Visual Basic. This property must be set if the TwainPRO object is created in-process or the Twain device will not function correctly. This is usually m_hWnd in an MFC application.

See Also

TwainPro Object


TwainPro Object

IBPP Property

Description

Gets and sets the bits per pixel of the current image.

Property type

Read-write property

Syntax (Visual Basic)

Public Property IBPP() As Long

Return Type

A long value which represents the bits per pixel of the current image.

Remarks

The IBPP property obtains the bits per pixel of the current image or image being acquired. IBPP is available at runtime and is read-only. IBPP is available in the PreScan event and thereafter.

See Also

TwainPro Object


TwainPro Object

ICompression Property

Description

Gets and sets the compression format of the current image.

Property type

Read-write property

Syntax (Visual Basic)

Public Property ICompression() As Long

Return Type

A long value which represents the compression format of the current image.

Remarks

The ICompression property obtains the compression format of the current image or image being acquired. ICompression is available at runtime and is read-only. ICompression is available in the PreScan event and thereafter.

ICompression returns one of the following values:

  • TWCP_NONE (0) — No Compression, TWCP_NONE means that the image is in an uncompressed DIB format and should be accessed through the hDIB property.

  • TWCP_PACKBITS (1) — Packbits

  • TWCP_ GROUP31D (2) — Group 3 1D, Follows CCITT spec (no End Of Line)

  • TWCP_GROUP31DEOL (3) — Group 3 1D, Follows CCITT spec (has End Of Line)

  • TWCP_GROUP32D (4) — Group 3 2D, Follows CCITT spec (use cap for K Factor)

  • TWCP_GROUP4 (5) — Group 4, Follows CCITT spec

  • TWCP_JPEG (6) — JPEG, TWCP_JPEG means that the image is in a JPEG format and should be accessed through the hImage property.

Note: All other values mean that the image is in a TIFF format and should be accessed through the hImage property.

See Also

TwainPro Object


TwainPro Object

IHeight Property

Description

Gets the height of the current image.

Property type

Read-write property

Syntax (Visual Basic)

Public Property IHeight() As Long

Return Type

A long value which represents the height of the current image.

Remarks

This property is used to obtain the height of the current image or image that is being acquired.

This property is available at runtime and is read-only. It is available in the PreScan event and thereafter.

The IHeight units are determined by the ICAP_UNITS capability.

See Also

TwainPro Object


TwainPro Object

IPixelType Property

Description

Gets the pixel type of the current image.

Property type

Read-write property

Syntax (Visual Basic)

Public Property IPixelType() As Long

Return Type

A long value which represents the pixel type of the current image.

Remarks

The IPixelType property is used to obtain the pixel type of the current image or image that is being acquired.

This property is available at runtime and is read-only. It is available in the PreScan event and thereafter.

See Also

TwainPro Object


TwainPro Object | TP_AdvancedCapability Enumeration

IResX Property

Description

Gets the X resolution of the current image.

Property type

Read-write property

Syntax (Visual Basic)

Public Property IResX() As Single

Return Type

A single value which represents the x resolution of the current image.

Remarks

This property is used to obtain the X resolution of the current image or image that is being acquired.

This property is available at runtime and is read-only. IResX is available in the PreScan event and thereafter.

The IResX units are determined by the ICAP_UNITS capability.

See Also

TwainPro Object | TP_AdvancedCapability Enumeration


TwainPro Object | TP_AdvancedCapability Enumeration

IResY Property

Description

Gets the Y resolution of the current image.

Property type

Read-write property

Syntax (Visual Basic)

Public Property IResY() As Single

Return Type

A single value which represents the y resolution of the current image.

Remarks

This property is used to obtain the Y resolution of the current image or image that is being acquired.

IResY is available at runtime and is read-only. IResY is available in the PreScan event and thereafter.

The IResY units are determined by the ICAP_UNITS capability.

See Also

TwainPro Object | TP_AdvancedCapability Enumeration


TwainPro Object | TP_AdvancedCapability Enumeration

IWidth Property

Description

Gets the width of the current image.

Property type

Read-write property

Syntax (Visual Basic)

Public Property IWidth() As Long

Return Type

A long value which represents the width of the current image.

Remarks

The IWidth property is used to obtain the width of the current image or image that is being acquired.

IWidth is available at runtime and is read-only. IWidth is available in the PreScan event and thereafter.

The IWidth units are determined by the ICAP_UNITS capability.

See Also

TwainPro Object | TP_AdvancedCapability Enumeration


TwainPro Object

Manufacturer Property

Description

Gets or sets the manufacturer string for the application identity.

Property type

Read-write property

Syntax (Visual Basic)

Public Property Manufacturer() As String

Return Type

A string value which determines the manufacturer name of an application.

Remarks

This property is used to identify a company name as manufacturer of an application. This information is sent to the TWAIN Data Source Manager. The application identity consists of the Manufacturer, ProductFamily, ProductName and VersionInfo properties.

This property should be set prior to invoking the OpenSession or StartSession methods.

See Also

TwainPro Object


TwainPro Object

MaxImages Property

Description

Gets or sets the maximum number of images expected from a TWAIN Data Source that supports multiple image scanning.

Property type

Read-write property

Syntax (Visual Basic)

Public Property MaxImages() As Long

Return Type

A long value which represents the maximum number of images expected from a TWAIN data source.

Remarks

This property is negotiated with the TWAIN Data Source during initialization (OpenSession) and should be set prior to invoking the OpenSession method.

This property is only used when the OpenSession method is invoked. To set the transfer count after calling OpenSession, use the TWCAP_XFERCOUNT capability.

A value of –1 indicates the application is willing to transfer multiple images.

A value of 1 indicates the application wishes to transfer only one image per session.

See Also

TwainPro Object


TwainPro Object

PendingXfers Property

Description

Gets and sets the number of image transfers the TWAIN Data Source is ready to supply to the TwainPRO control.

Property type

Read-write property

Syntax (Visual Basic)

Public Property PendingXfers() As Long

Return Type

A long value which represents the number of image transfers the TWAIN data source is ready to supply to the TwainPRO component.

Remarks

This property is only valid during the PreScan and PostScan events.

The TWAIN Data Source will return -1 if it is not sure how many transfers are pending. Scanners with Automatic Document Feeders (ADF) will typically return -1.

See Also

TwainPro Object


TwainPro Object

PICPassword Property

Description

Gets or sets the password for an ePIC file.

Property type

Read-write property

Syntax (Visual Basic)

Public Property PICPassword() As String

Return Type

A string value which represents the password for an ePIC file.

Remarks

The ePIC (.PIC) format allows you to save a password protected file. The password can contain a maximum of eight characters. When the PICPassword property is set and an ePIC file is saved using the SaveFile method, the file will be encrypted using the PICPassword.

Note: PICPassword applies to ePIC images only.

See Also

TwainPro Object


TwainPro Object | StartSession Method

Picture Property

Description

Gets or sets a picture object containing a copy of the current frame buffer.

Property type

Read-write property

Syntax (Visual Basic)

Public Property Picture() As Picture

Return Type

A Picture object which contains a copy of the current frame buffer.

Remarks

There must be an image available. This is accomplished by using the StartSession method to acquire an image.

Attempting to access this property when there is no image will return an error.

This property returns a VB picture object for use with other controls that support the picture object including the standard VB picture control.

This property is not compatible with Delphi.

See Also

TwainPro Object | StartSession Method


TwainPro Object

ProductFamily Property

Description

Gets or sets the Product Family string for the application identity.

Property type

Read-write property

Syntax (Visual Basic)

Public Property ProductFamily() As String

Return Type

A string value which represents the product family description for the application identity.

Remarks

The default value is an empty string "".

This property is used to identify a software group that the application belongs to. This information is sent to the TWAIN Data Source Manager. The application identity consists of the Manufacturer, ProductFamily, ProductName and VersionInfo properties.

This property should be set prior to invoking the OpenSession or StartSession methods.

See Also

TwainPro Object


TwainPro Object

ProductName Property

Description

Gets or sets the Product Name string for the application identity.

Property type

Read-write property

Syntax (Visual Basic)

Public Property ProductName() As String

Return Type

A string value which represents the product name.

Remarks

The default value is an empty string "".

This property is used to identify an application name. This information is sent to the TWAIN Data Source Manager. The application identity consists of the Manufacturer, ProductFamily, ProductName and VersionInfo properties.

This property should be set prior to any calls to the OpenSession or StartSession methods.

ProductName is the most common method for identifying TWAIN applications for Data Sources. Product names for applications are displayed by some Data Sources.

See Also

TwainPro Object


TwainPro Object

ProxyServer Property

Description

Many organizations use a proxy server to allow individual computers to access the Internet through the local LAN.

Property type

Read-write property

Syntax (Visual Basic)

Public Property ProxyServer() As String

Return Type

A string value which represents the proxy server name.

Remarks

This property specifies the name of the ProxyServer which can be a word such as "MyProxyServer" or an IP address such as "10.1.1.56". If the computer uses a direct connection such as Dial-Up Networking, the computer does not use a proxy server and this property should be blank.

See Also

TwainPro Object


TwainPro Object

RaiseExceptions Property

Description

Gets and sets whether exceptions are raised.

Property type

Read-write property

Syntax (Visual Basic)

Public Property RaiseExceptions() As Boolean

Return Type

A boolean value which is True to raise exceptions. Otherwise, False is returned when exceptions are not raised.

See Also

TwainPro Object


TwainPro Object | TP_SaveFileType Enumeration

SaveFileType Property

Description

Gets and sets the type of file to save.

Property type

Read-write property

Syntax (Visual Basic)

Public Property SaveFileType() As TP_SaveFileType

Return Type

A TP_SaveFileType enumeration value which determines the type of file to save.

See Also

TwainPro Object | TP_SaveFileType Enumeration


TwainPro Object

SaveIFDOffset Property

Description

Gets and sets the location to append the next TIFF page when fast saving of multi-page TIFF files is invoked.

Property type

Read-write property

Syntax (Visual Basic)

Public Property SaveIFDOffset() As Long

Return Type

A long value which represents the index location to append the next TIFF page.

Remarks

The default value is 0.

See Also

TwainPro Object


TwainPro Object

SaveJBIG2EncodeModeCompression Property

Description

Gets and sets the encoding mode to use when creating JBIG2 compressed files.

Property type

Read-write property

Syntax (Visual Basic)

Public Property SaveJBIG2EncodeModeCompression() As TP_SaveJBIG2EncodeModeCompression

Return Type

A TP_SaveJBIG2EncodeModeCompression enumeration value which determines the encoding mode to use when creating JBIG2 compressed files.

Remarks

The default value is TP_SaveJBIG2EncodeModeCompression_AutoDetect.

Text regions can be encoded as lossless or as lossy according to the encoding mode specified. The lossy modes use the value in SavePDFCompression to control how loose to be when matching symbols and thereby increase compression and reduce file size. Compression means loss, however, and a consequence of higher compression is an increased risk of errors in the reconstructed image.

Specify a larger value of looseness to reduce the compressed file size; use a smaller value to reduce the errors, if any. Halftone regions can be encoded lossy by specifying one of the lossy halftone encoding modes. Alternatively, they can be encoded lossless by using the lossless generic encoding mode.

See Also

TwainPro Object


TwainPro Object

SaveJBIG2FileOrgCompression Property

Description

Gets and sets the file organization when saving a JBIG2 compressed file.

Property type

Read-write property

Syntax (Visual Basic)

Public Property SaveJBIG2FileOrgCompression() As TP_SaveJBIG2FileOrgCompression

Return Type

A TP_SaveJBIG2FileOrgCompression type file.

Remarks

The default value is TP_SaveJBIG2FileOrgCompression_Default.

A JBIG2 compressed file may be organized in two ways: sequential or random access. Sequential organization is intended for streaming applications, where the decoder reads and decodes the file in order as the data is received. Random access organization permits the decoder to know the entire file structure, without having to read the entire file, and then uses that information to access the required data in a random-access fashion. This organization is useful for applications such as decoding only odd-number pages.

See Also

TwainPro Object


TwainPro Object

SaveJBIG2InvertedRegion Property

Description

Gets and sets an indicator if the bits should be inverted prior to symbol analysis.

Property type

Read-write property

Syntax (Visual Basic)

Public Property SaveJBIG2InvertedRegion() As Boolean

Return Type

A boolean value which is True if the bits are inverted prior to symbol analysis. Otherwise, False should be used and the bits are not inverted prior to symbol analysis.

Remarks

The default value is False.

Inverting the bits prior to symbol analysis may provide better compression if the text is represented as light bits against a dark background instead of the opposite. This setting is only used by the text encode modes.

See Also

TwainPro Object


TwainPro Object

SaveJBIG2LoosenessCompression Property

Description

Gets and sets how loose to be when matching symbols and compressing text using either of the lossy text region encode modes.

Property type

Read-write property

Syntax (Visual Basic)

Public Property SaveJBIG2LoosenessCompression() As Long

Return Type

A long value which represents the looseness.

Remarks

The default value is 0.

Default results in the lossless compression.

This property provides the ability to set how loose to be when matching symbols and compressing text using either of the lossy text region encoding modes. The larger the number, the greater the compression and the greater the risk of introducing errors.

Set to 50 for a reasonably small file size and low risk of error.

If set to 0, the compression is lossless.

See Also

TwainPro Object


TwainPro Object

SaveJPEGChromFactor Property

Description

Gets and sets the chrominance quality setting for saving JPEG and ePIC files.

Property type

Read-write property

Syntax (Visual Basic)

Public Property SaveJPEGChromFactor() As Long

Return Type

A long value which represents the chrominance quality setting for saving JPEG and ePIC files.

Remarks

JPEG and ePIC images are stored in a compressed format. Compression is lossy which means when you save a JPEG or ePIC file, there will be data loss. Data loss is the result of JPEG and ePICs ability to achieve high compression ratios. Higher quality settings result in less compression, while lower quality settings result in higher compression. Quality versus compression is a tradeoff.

The image compression ratio can be adjusted by setting the SaveJPEGLumFactor and SaveJPEGChromFactor properties. The SaveJPEGLumFactor adjusts the luminance or gray scale quality and the SaveJPEGChromFactor adjusts the chrominance or color quality. Lower settings for these properties result in higher quality images with less compression. Higher settings for these properties result in lower quality images with more compression.

For general use photographic type images, the settings of 32 for luminance and 36 for chrominance provides about a 12:1 image compression ratio with minimal data loss. Compression ratios and perceived image quality will vary depending on the image.

See Also

TwainPro Object


TwainPro Object

SaveJPEGLumFactor Property

Description

Gets and sets the luminance quality setting for saving JPEG and ePIC files.

Property type

Read-write property

Syntax (Visual Basic)

Public Property SaveJPEGLumFactor() As Long

Return Type

A long value which represents the luminance quality settings for saving JPEG and ePIC files.

Remarks

JPEG and ePIC images are stored in a compressed format. Compression is lossy which means when you save a JPEG or ePIC file, there will be data loss. Data loss is the result of JPEG and ePICs ability to achieve high compression ratios. Higher quality settings result in less compression, while lower quality settings result in higher compression.

Quality versus compression is a tradeoff.

The image compression ratio can be adjusted by setting this property and SaveJPEGChromFactor properties. The SaveJPEGLumFactor adjusts the luminance or gray scale quality and the SaveJPEGChromFactor adjusts the chrominance or color quality. Lower settings for these properties result in higher quality images with less compression. Higher settings for these properties result in lower quality images with more compression.

For general use photographic type images, the settings of 32 for luminance and 36 for chrominance provides about a 12:1 image compression ratio with minimal data loss. Compression ratios and perceived image quality will vary depending on the image.

See Also

TwainPro Object


TwainPro Object

SaveJPEGProgressive Property

Description

Gets and sets whether JPEG or ePIC files are to be saved as standard files or progressive files.

Property type

Read-write property

Syntax (Visual Basic)

Public Property SaveJPEGProgressive() As Boolean

Return Type

A boolean value which is True to save as progressive files. Otherwise, False is used and saved as standard files.

Remarks

The default value is False.

See Also

TwainPro Object


TwainPro Object

SaveJPEGSubSampling Property

Description

Gets and sets the desired sub-sampling.

Property type

Read-write property

Syntax (Visual Basic)

Public Property SaveJPEGSubSampling() As TP_SubSample

Return Type

A TP_SubSample enumeration value which determines the sub-sampling.

Remarks

The default value is TP_SubSample_411.

The values 111 and no sub-sampling, provides the highest image quality with lower compression, while the default 411 provides the best compression with lower image quality.

See Also

TwainPro Object


TwainPro Object

SaveMultiPage Property

Description

Gets and sets if a TIFF file should be saved as the next page in an existing file.

Property type

Read-write property

Syntax (Visual Basic)

Public Property SaveMultiPage() As Boolean

Return Type

A boolean value which is True if a TIFF or PDF file is saved as the next page in an existing file. Otherwise, False should be used and a TIFF or PDF file is not saved as the next page in an existing file.

Remarks

This property applies only when saving TIFF or PDF files. It is ignored for all other image file formats. If this property is True and the filename specified when calling SaveFile exists, the image appends to the existing file.

Note: When this property is set to True and an FTP or HTTP address location is specified in the SaveFile FileName parameter, a multi-page file will not be created as this property only supports saving to local files.

See Also

TwainPro Object


TwainPro Object

SavePDFCompression Property

Description

Gets and sets the compression type for saving a PDF file.

Property type

Read-write property

Syntax (Visual Basic)

Public Property SavePDFCompression() As TP_SavePDFCompressionType

Return Type

A TP_SavePDFCompressionType enumeration value which determines the compression type for saving a PDF file.

Remarks

The default value is TP_SavePDFCompressionType_Default.

See Also

TwainPro Object


TwainPro Object

SavePDFSwapBlackAndWhite Property

Description

Gets and sets an indicator if the pixel value of zero is set to black or white.

Property type

Read-write property

Syntax (Visual Basic)

Public Property SavePDFSwapBlackAndWhite() As Boolean

Return Type

A boolean value which is True to set the pixel value in the saved image to 1 = black and 0 = white. Otherwise, False sets the pixel value in the saved image to 1 = white and 0 = black.

Remarks

The default value is False.

See Also

TwainPro Object


TwainPro Object

SaveTIFFCompression Property

Description

Gets and sets the TIFF compression type for saving a TIFF file.

Property type

Read-write property

Syntax (Visual Basic)

Public Property SaveTIFFCompression() As TP_SaveTIFFCompressionType

Return Type

A TP_SaveTIFFCompressionType enumeration value which determines the compression type for saving a TIFF file.

See Also

TwainPro Object


TwainPro Object

SaveUseIFDOffset Property

Description

Gets and sets an indicator to enable fast multi-page TIFF writes.

Property type

Read-write property

Syntax (Visual Basic)

Public Property SaveUseIFDOffset() As Boolean

Return Type

A boolean value which is True to enable fast multi-page TIFF writes. Otherwise, False should be set.

Remarks

The default value is False.

See Also

TwainPro Object


TwainPro Object

ShadowText Property

Description

Gets and sets if a drop shadow should be placed under the caption.

Property type

Read-write property

Syntax (Visual Basic)

Public Property ShadowText() As Boolean

Return Type

A boolean value which is True to place a drop shadow under the caption. Otherwise, False should be used.

Remarks

The color of the drop shadow is calculated automatically from the value of the ForeColor property.

See Also

TwainPro Object


TwainPro Object

ShowUI Property

Description

Gets or sets whether the TWAIN data source displays its user interface when invoking the StartSession method.

Property type

Read-write property

Syntax (Visual Basic)

Public Property ShowUI() As Boolean

Return Type

A boolean value which is True to display the data source user interface. Otherwise, False should be used and the user interface is not displayed.

Remarks

When ShowUI is set to True the TWAIN Data Source will display its User Interface when invoking the StartSession method. If ShowUI is set to False the Data Source UI will not be displayed and scanning will begin immediately using the current capability values.

See Also

TwainPro Object


TwainPro Object | OpenSession Method | TP_TransferMode Enumeration

See Also Pegasus Imaging TwainPro Control 5.0 Send comments on this topic.

TransferMode Property

Description

Gets or sets the transfer mode for scanning.

Property type

Read-write property

Syntax (Visual Basic)

Public Property TransferMode() As TP_TransferMode

Return Type

A TP_TransferMode enumeration value which determines the transfer mode for scanning.

Remarks

This property is used to set or obtain the current method of transferring images from the Data Source. The TransferMode should be set to the value desired prior to a call to the OpenSession or StartSession methods. The default TransferMode of the TwainPRO control is the Native transfer mode.

This property is available at runtime only.

Note: Transferring of compressed data directly from a Data Source requires that buffered memory mode, TWSX_MEMORY, be used.

See Also

TwainPro Object | OpenSession Method | TP_TransferMode Enumeration


TwainPro Object

TwainConditionCode Property

Description

Gets additional TWAIN error information from the data source.

Property type

Read-write property

Syntax (Visual Basic)

Public Property TwainConditionCode() As Long

Return Type

A long value which represents the error information.

Remarks

The default value is 0.

See Also

TwainPro Object


TwainPro Object

TwainConditionDescription Property

Description

Gets the TWAIN error information description from the data source.

Property type

Read-write property

Syntax (Visual Basic)

Public Property TwainConditionDescription() As String

Return Type

A string value which represents the description error information.

Remarks

The default value is an empty string "".

See Also

TwainPro Object


TwainPro Object

VAlign Property

Description

Gets and sets the vertical alignment of the caption within the clipping rectangle.

Property type

Read-write property

Syntax (Visual Basic)

Public Property VAlign() As TP_VerticalAlignment

Return Type

A TP_VerticalAlignment enumeration value which determines the vertical alignment within the clipping rectangle.

Remarks

The clipping rectangle is determined by the ClipCaption and Caption rectangle properties.

See Also

TwainPro Object


TwainPro Object

VersionInfo Property

Description

Gets or sets the version information string for the application identity.

Property type

Read-write property

Syntax (Visual Basic)

Public Property VersionInfo() As String

Return Type

A string value which represents the version information for the application.

Remarks

This property is used to identify an application's version. This information is sent to the TWAIN Data Source Manager. The application identity consists of the Manufacturer, ProductFamily, ProductName and VersionInfo properties.

This property should be set prior to invoking the OpenSession or StartSession methods.

See Also

TwainPro Object


TwainPro Object

Cancel
A boolean value which, if set to True, the session ends and the StartSession method returns control.
See Also Pegasus Imaging TwainPro Control 5.0 Send comments on this topic.

PostScan Event

Description

Raised after a scan or transfer ends.

Syntax

Public Event PostScan( _
   ByRef Cancel As Boolean _
)

Parameters

Cancel
A boolean value which, if set to True, the session ends and the StartSession method returns control.

Remarks

This is the place to use the SaveFile method to save an image or the hDIB property to do a memory transfer of an image.

See Also

TwainPro Object


TwainPro Object

Cancel
A boolean value, which if set to True, the session ends and the StartSession method returns control.
See Also Pegasus Imaging TwainPro Control 5.0 Send comments on this topic.

PreScan Event

Description

Raised before a scan or transfer begins.

Syntax

Public Event PreScan( _
   ByRef Cancel As Boolean _
)

Parameters

Cancel
A boolean value, which if set to True, the session ends and the StartSession method returns control.

Remarks

This is the place to check the PendingXfers property.

See Also

TwainPro Object


TP_AdvancedCapability Enumeration

Description

Specifies valid values for use in specifying capabilities.

Members

Member | Description
CAP_XFERCOUNT | (1) - Transfer count
ICAP_COMPRESSION | 200 series (256) Image data sources are REQUIRED to support these caps
ICAP_PIXELTYPE | (257) - Capability pixel type
ICAP_UNITS | (258) - Capability units
ICAP_XFERMECH | (259) - Capability transfer mechanism
CAP_AUTHOR | 4000 series (4096) All data sources MAY support these caps
CAP_CAPTION | (4097) - Capability caption
CAP_FEEDERENABLED | (4098) - Capability feeder enabled
CAP_FEEDERLOADED | (4099) - Capability feedber loaded
CAP_TIMEDATE | 4100 series (4100) - Capability time date
CAP_SUPPORTEDCAPS | (4101) - Supported capabilities
CAP_EXTENDEDCAPS | (4102) - Extended capabilities
CAP_AUTOFEED | (4103) - Auto feed
CAP_CLEARPAGE | (4104) - Clear page
CAP_FEEDPAGE | (4105) - Feed page
CAP_REWINDPAGE | (4106) - Rewind page
CAP_INDICATORS | (4107) - Capability indicators
CAP_SUPPORTEDCAPSEXT | (4108) - Supported extended capabilities
CAP_PAPERDETECTABLE | (4109) - Paper detectable
CAP_UICONTROLLABLE | (4110) - User interface controllable
CAP_DEVICEONLINE | (4111) - Device online
CAP_AUTOSCAN | (4112) - Auto scan
CAP_THUMBNAILSENABLED | (4113) - thumbnails enabled
CAP_DUPLEX | (4114) - Duplex
CAP_DUPLEXENABLED | (4115) - Duplex enabled
CAP_ENABLEDSUIONLY | (4116) - Enabled user interface only
CAP_CUSTOMDSDATA | (4117) - Custom data
CAP_ENDORSER | (4118) - Endorser
CAP_JOBCONTROL | (4119) - Job control
CAP_ALARMS | (4120) - Alarms
CAP_ALARMVOLUME | (4121) - Alarm volume
CAP_AUTOMATICCAPTURE | (4122) - Automatic capture
CAP_TIMEBEFOREFIRSTCAPTURE | (4123) - Time before first capture
CAP_TIMEBETWEENCAPTURES | (4124) - Time between captures
CAP_CLEARBUFFERS | (4125) - Clear buffers
CAP_MAXBATCHBUFFERS | (4126) - Max batch buffers
CAP_DEVICETIMEDATE | (4127) - Device time date
CAP_POWERSUPPLY | (4128) - Power supply
CAP_CAMERAPREVIEWUI | (4129) - Camera preview user interface
CAP_DEVICEEVENT | (4130) - Device event
CAP_PAGEMULTIPLEACQUIRE | (4131) - Acquire multiple pages
CAP_SERIALNUMBER | (4132) - Serial number
CAP_FILESYSTEM | (4133) - File system
CAP_PRINTER | (4134) - Printer
CAP_PRINTERENABLED | (4135) - Printer enabled
CAP_PRINTERINDEX | (4136) - Printer index
CAP_PRINTERMODE | (4137) - Printer mode
CAP_PRINTERSTRING | (4138) - Printer string
CAP_PRINTERSUFFIX | (4139) - Printer suffix
CAP_LANGUAGE | (4140) - Language
CAP_FEEDERALIGNMENT | (4141) - Feeder alignment
CAP_FEEDERORDER | (4142) - Feeder order
CAP_PAPERBINDING | (4143) - Paper binding
CAP_REACQUIREALLOWED | (4144) - Reacquire allowed
CAP_PASSTHRU | (4145) - Pass thru
CAP_BATTERYMINUTES | (4146) - Battery minutes
CAP_BATTERYPERCENTAGE | (4147) - Battery percentage
ICAP_AUTOBRIGHT | 4300 series (4352) Image data sources may support these caps
ICAP_BRIGHTNESS | (4353) - Brightness
ICAP_CONTRAST | (4355) not 4354 - Contrast
ICAP_CUSTHALFTONE | (4356) - Custom halftone
ICAP_EXPOSURETIME | (4357) - Exposure time
ICAP_FILTER | (4358) - Filter
ICAP_FLASHUSED | (4359) - Flash used
ICAP_GAMMA | (4360) - Gamma
ICAP_HALFTONES | (4361) - Halftones
ICAP_HIGHLIGHT | (4362) - Highlight
ICAP_IMAGEFILEFORMAT | (4364) not 4363 - Image file format
ICAP_LAMPSTATE | (4365) - Lamp state
ICAP_LIGHTSOURCE | (4366) - Light source
ICAP_ORIENTATION | (4368) not 4367 - Orientation
ICAP_PHYSICALWIDTH | (4369) - Physical width
ICAP_PHYSICALHEIGHT | (4370) - Physical height
ICAP_SHADOW | (4371) - Shadow
ICAP_FRAMES | (4372) - Frames
ICAP_XNATIVERESOLUTION | (4374) not 4373 - x coordinate native resolution
ICAP_YNATIVERESOLUTION | (4375) - y coordinate native resolution
ICAP_XRESOLUTION | (4376) - x resolution
ICAP_YRESOLUTION | (4377) - y resolution
ICAP_MAXFRAMES | (4378) - Maximum frames
ICAP_TILES | (4379) - Tiles
ICAP_BITORDER | (4380) - Bit order
ICAP_CCITTKFACTOR | (4381) - CCITTK Factor
ICAP_LIGHTPATH | (4382) - Light path
ICAP_PIXELFLAVOR | (4383) - Pixel flavor
ICAP_PLANARCHUNKY | (4384) - Planar chunky
ICAP_ROTATION | (4385) - Rotation
ICAP_SUPPORTEDSIZES | (4386) - Supported sizes
ICAP_THRESHOLD | (4387) - Threshold
ICAP_XSCALING | (4388) - X scaling
ICAP_YSCALING | (4389) - Y scaling
ICAP_BITORDERCODES | (4390) - Bit order codes
ICAP_PIXELFLAVORCODES | (4391) - Pixel flavor codes
ICAP_JPEGPIXELTYPE | (4392) - JPEG pixel type
ICAP_TIMEFILL | (4394) - Time fill
ICAP_BITDEPTH | (4395) - Bit depth
ICAP_BITDEPTHREDUCTION | (4396) - Bit depth reduction
ICAP_UNDEFINEDIMAGESIZE | (4397) - Undefined image size
ICAP_IMAGEDATASET | (4398) - Image data set
ICAP_EXTIMAGEINFO | (4399) - Extended image info
ICAP_MINIMUMHEIGHT | 4400 series (4400) - Minimum height
ICAP_MINIMUMWIDTH | (4401) - Minimum width
ICAP_FLIPROTATION | (4402) - Flip rotation
ICAP_BARCODEDETECTIONENABLED | (4403) - Barcode detection enabled
ICAP_SUPPORTEDBARCODETYPES | (4408) - Supported barcode types
ICAP_BARCODEMAXSEARCHPRIORITIES | (4409) - Barcode maximum search priorities (4410)
ICAP_BARCODESEARCHPRIORITIES | (4410) - Barcode search priorities
ICAP_BARCODESEARCHMODE | (4411) - Barcode search mode
ICAP_BARCODEMAXRETRIES | (4412) - Barcode maximum retries
ICAP_BARCODETIMEOUT | (4413) - Barcode timeout
ICAP_ZOOMFACTOR | (4414) - Zoom factor
ICAP_PATCHCODEDETECTIONENABLED | (4415) - Patch code detection enabled
ICAP_SUPPORTEDPATCHCODETYPES | (4416) - Supported path code types
ICAP_PATCHCODEMAXSEARCHPRIORITIES | (4417) - Patch code maximum search priorities
ICAP_PATCHCODESEARCHPRIORITIES | (4418) - Patch code search priorities
ICAP_PATCHCODESEARCHMODE | (4419) - Patch code search mode
ICAP_PATCHCODEMAXRETRIES | (4420) - Patch code maximum retries
ICAP_PATCHCODETIMEOUT | (4421) - Patch code timeout
ICAP_FLASHUSED2 | (4422) - Flash used 2
ICAP_IMAGEFILTER | (4423) - Image filter
ICAP_NOISEFILTER | (4424) - Noise filter
ICAP_OVERSCAN | (4424) - Over scan
ICAP_AUTOMATICBORDERDETECTION | (4432) not 4425 - Automatic border detection
ICAP_AUTOMATICDESKEW | (4433) - Automatic deskew
ICAP_AUTOMATICROTATE | (4434) - Automatic rotate
ICAP_JPEGQUALITY | (4135) - JPEG quality
ACAP_AUDIOFILEFORMAT | 4600 series (4609) Image data sources MAY support these audio caps
ACAP_XFERMECH | (4610) - Advanced capability transfer mechanism

Remarks

Image data sources are REQUIRED to support these capabilities: ICAP_COMPRESSION, ICAP_PIXELTYPE, ICAP_UNITS, ICAP_XFERMECH.


TP_Capability Enumeration

Description

Specifies valid values for use in specifying capabilities for the Capability property.

Members

Member | Description
TP_ICAP_AUTOBRIGHT | 0 - Auto bright
TP_ICAP_BRIGHTNESS | 1 - Brightness
TP_ICAP_CONTRAST | 2 - Contrast
TP_ICAP_GAMMA | 3 - Gamma
TP_ICAP_PHYSICALWIDTH | 4 - Physical width
TP_ICAP_PHYSICALHEIGHT | 5 - Physical height
TP_ICAP_PIXELTYPE | 6 - Pixel type
TP_ICAP_ROTATION | 7 - Rotation
TP_ICAP_UNITS | 8 - Units
TP_ICAP_XNATIVERESOLUTION | 9 - x native resolution
TP_ICAP_YNATIVERESOLUTION | 10 - y native resolution
TP_ICAP_XRESOLUTION | 11 - x resolution
TP_ICAP_YRESOLUTION | 12 - y resolution
TP_ICAP_XSCALING | 13 - x scaling
TP_ICAP_YSCALING | 14 - y scaling
TP_CAP_DEVICEONLINE | 15 - Device online
TP_CAP_INDICATORS | 16 - Indicators
TP_ICAP_LAMPSTATE | 17 - Lamp state
TP_CAP_UICONTROLLABLE | 18 - User interface controllable
TP_CAP_XFERCOUNT | 19 - Transfer count
TP_CAP_AUTOFEED | 20 - Auto feed
TP_CAP_AUTOSCAN | 21 - Auto scan
TP_CAP_CLEARPAGE | 22 - Clear page
TP_CAP_DUPLEX | 23 - Duplex
TP_CAP_DUPLEXENABLED | 24 - Duplex enabled
TP_CAP_FEEDERENABLED | 25 - Feeder enabled
TP_CAP_FEEDERLOADED | 26 - Feeder loaded
TP_CAP_FEEDPAGE | 27 - Feed page
TP_CAP_PAPERDETECTABLE | 28 - Paper detectable
TP_ICAP_BITDEPTH | 29 - Bit depth
TP_ICAP_SUPPORTEDSIZES | 30 - Supported sizes
TP_Capability_UseCapAdvanced | 100 - Use advanced capabilities
TP_Capability_UseCapAdvancedForExtInfo | 101 - Use advanced capabilities for extended info


TP_CapAdvConstants Enumeration

Description

Specifies valid values for use in specifying capabilities.

Members

Member | Description
TWFT_RED | 0 - Filter type red
TWFT_GREEN | 1 - Filter type green
TWFT_BLUE | 2 - Filter type blue
TWFT_NONE | 3 - Filter type none
TWFT_WHITE | 4 - Filter type white
TWFT_CYAN | 5 - Filter type cyan
TWFT_MAGENTA | 6 - Filter type magenta
TWFT_YELLOW | 7 - Filter type yellow
TWFT_BLACK | 8 - Filter type black
TWLP_REFLECTIVE | 0 - Light path reflective
TWLP_TRANSMISSIVE | 1 - Light path transmissive
TWLS_RED | 0 - Light source red
TWLS_GREEN | 1 - Light source green
TWLS_BLUE | 2 - Light source blue
TWLS_NONE | 3 - Light source none
TWLS_WHITE | 4 - Light source white
TWLS_UV | 5 - Light source ultraviolet
TWLS_IR | 6 - Light source IR
TWPF_CHOCOLATE | 0 - Pixel chocolate represents the darkest shade
TWPF_VANILLA | 1 - zero pixel represents lightest shade.
TWBR_THRESHOLD | 0 - Bitdepth reduction threshold
TWBR_HALFTONE | 1 - Bitdepth reduction halftone
TWBR_CUSTHALFTONE | 2 - Bitdepth reduction custom halftone
TWBR_DIFFUSION | 3 - Bitdepth reduction diffusion
TWAL_ALARM | 0 - Alarms
TWAL_FEEDERERROR | 1 - Alarm feeder error
TWAL_FEEDERWARNING | 2 - Alarm feeder warning
TWAL_BARCODE | 3 - Alarm barcode
TWAL_DOUBLEFEED | 4 - Alarm double feed
TWAL_JAM | 5 - Alarm jam
TWAL_PATCHCODE | 6 - Alarm patch code
TWAL_POWER | 7 - Alarm power
TWAL_SKEW | 8 - Alarm skew
TWCB_AUTO | 0 - Clear buffer auto
TWCB_CLEAR | 1 - Clear buffer clear
TWCB_NOCLEAR | 2 - Clear buffer no clear
TWFA_NONE | 0 - Feeder alignment none
TWFA_LEFT | 1 - Feeder alignment left
TWFA_CENTER | 2 - Feeder alignment center
TWFA_RIGHT | 3 - Feeder alignment right
TWFO_FIRSTPAGEFIRST | 0 - Feeder order first page first
TWFO_LASTPAGEFIRST | 1 - Feeder order last page first
TWPS_EXTERNAL | 0 - External power supply
TWPS_BATTERY | 1 - Battery power supply
TWBD_HORZ | 0 - Search barcode horizontal
TWBD_VERT | 1 - Search barcode vertical
TWBD_HORZVERT | 2 - Search barcode horizontal then vertical
TWBD_VERTHORZ | 3 - Search barcode vertical then horizontal
TWFL_NONE | 0 - Flash none
TWFL_OFF | 1 - Flash off
TWFL_ON | 2 - Flash on
TWFL_AUTO | 3 - Flash auto
TWFL_REDEYE | 4 - Flash redeye
TWFR_BOOK | 0 - Flip rotation book
TWFR_FANFOLD | 1 - Flip rotation fan fold
TWIF_NONE | 0 - Image filter none
TWIF_AUTO | 1 - Image filter auto
TWIF_LOWPASS | 2 - Image filter low pass
TWIF_BANDPASS | 3 - Image filter band pass
TWIF_HIGHPASS | 4 - Image filter high pass
TWIF_TEXT | 5 - Image filter text
TWIF_FINELINE | 6 - Image filter fine line
TWNF_NONE | 0 - Noise filter none
TWNF_AUTO | 1 - Noise filter auto
TWNF_LONEPIXEL | 2 - Noise filter lone pixel
TWNF_MAJORITYRULE | 3 - Noise filter majority rule
TWOV_NONE | 0 - Overscan none
TWOV_AUTO | 1 - Overscan auto
TWOV_TOPBOTTOM | 2 - Overscan top to bottom
TWOV_LEFTRIGHT | 3 - Overscan left to right
TWOV_ALL | 4 - Overscan
TWCP_NONE | 0 - Compression none
TWCP_PACKBITS | 1 - Compression pack bits
TWCP_GROUP31D | 2 - Compression group 31 D
TWCP_GROUP31DEOL | 3 - Compression group 31 DEOL
TWCP_GROUP32D | 4 - Compression group 32 D
TWCP_GROUP4 | 5 - Compression group 4
TWCP_JPEG | 6 - Compression JPEG
TWJQ_UNKNOWN | JPEG quality unknown (0xfffffffc)
TWJQ_LOW | JPEG quality low (0xfffffffd) (seven fs)
TWJQ_MEDIUM | JPEG quality medium (0xfffffffe)
TWJQ_HIGH | JPEG quality high (0xffffffff)

Remarks

© 2008, Pegasus Imaging Corporation, All Rights Reserved.


TP_CapConstants Enumeration

Description

Option values for use in specifying capabilities.

Members

Member | Description
TWPT_BW | (0) Black & White
TWPT_GRAY | (1) Grayscale
TWPT_RGB | (2) True Color: 24-bit
TWPT_PALETTE | (3) Palette: 8-bit
TWUN_INCHES | (0) Twain units in inches
TWUN_CENTIMETERS | (1) Twain units in centimeters
TWUN_PICAS | (2) Twain units in picas
TWUN_POINTS | (3) Twain units in points
TWUN_TWIPS | (4) Twain units in twips
TWUN_PIXELS | (5) Twain units in pixels
TWDX_NONE | (0) Twain duplex none
TWDX_1PASSDUPLEX | (1) Duplex one pass
TWDX_2PASSDUPLEX | (2) Duplex two pass


TP_CapType Enumeration

Description

Option values for use in specifying capabilities for the CapType and CapTypeOut properties.

Members

Member | Description
TWON_ONEVALUE | (0) One value
TWON_ENUM | (1) Enumeration
TWON_RANGE | (2) Range
TWON_ARRAY | (3) Array


TP_ChoiceType Enumeration

Description

Option values which determine the Twain choice type.

Members

Member | Description
TP_ChoiceType_Range | (0) Range
TP_ChoiceType_ListInt | (1) Integer list
TP_ChoiceType_ListAscii | (2) ASCII list


TP_ConditionCode Enumeration

Description

Option values for specifying extended error information.

Members

Member | Description
TWCC_CUSTOMBASE | 0x8000 (32768) - Custom base
TWCC_SUCCESS | 0 - Success
TWCC_BUMMER | 1 - Failure due to unknown causes
TWCC_LOWMEMORY | 2 - Not enough memory to perform operation
TWCC_NODS | 3 - No Data Source
TWCC_MAXCONNECTIONS | 4 - DS is connected to max possible applications
TWCC_OPERATIONERROR | 5 - DS or DSM reported error, application shouldn't
TWCC_BADCAP | 6 - Unknown capability
TWCC_BADPROTOCOL | 9 - not 7, Unrecognized MSG DG DAT combination
TWCC_BADVALUE | 10 - Data parameter out of range
TWCC_SEQERROR | 11 - DG DAT MSG out of expected sequence
TWCC_BADDEST | 12 - Unknown destination Application/Source in DSM_Entry
TWCC_CAPUNSUPPORTED | 13 - Capability not supported by source
TWCC_CAPBADOPERATION | 14 - Operation not supported by capability
TWCC_CAPSEQERROR | 15 - Capability has dependency on other capability
TWCC_DENIED | 16 - File System operation is denied (file is protected)
TWCC_FILEEXISTS | 17 - Operation failed because file already exists
TWCC_FILENOTFOUND | 18 - File not found
TWCC_NOTEMPTY | 19 - Operation failed because directory is not empty
TWCC_PAPERJAM | 20 - The feeder is jammed
TWCC_PAPERDOUBLEFEED | 21 - The feeder detected multiple pages
TWCC_FILEWRITEERROR | 22 - Error writing the file (meant for things like disk full conditions)
TWCC_CHECKDEVICEONLINE | 23 - The device went offline prior to or during this operation

Remarks

Please see the Extended Error Codes xx topic for more information.


DebugLogFile Property | Debug Property | DebugErrorLevel Property

See Also Pegasus Imaging TwainPro Control 5.0 Send comments on this topic.

TP_DebugErrorLevel Enumeration

Description

Option values which determine the error level of items to place into the debug log.

Members

Member | Description
TP_DebugErrorLevel_Production | Place minimal information into the debug log file.
TP_DebugErrorLevel_Development | Place information into the debug log file that is useful during normal development using this toolkit.
TP_DebugErrorLevel_Detailed | Place as much information into the debug log file as possible. You should use this option when you are tracking down a problem.

See Also

DebugLogFile Property | Debug Property | DebugErrorLevel Property


TP_ErrorCode Enumeration

Description

Specifies valid values for error codes.

Members

Member | Description
TP_ErrorCode_None | 0 - Error code none
TP_ErrorCode_Twain | 7000 - Check ErrorCode & ErrorString properties
TP_ErrorCode_TInit | 7001 - Can't find or load twain_32.dll
TP_ErrorCode_FileOpen | 7002 -Can't open file
TP_ErrorCode_MemoryAlloc | 7003 - Can't allocate memory for operation
TP_ErrorCode_Canceled | 7004 - User cancelled operation
TP_ErrorCode_CreateFile | 7005 - Error creating file
TP_ErrorCode_FileWrite | 7006 - Error writing file
TP_ErrorCode_FormatNotSupported | 7007 - File format not supported
TP_ErrorCode_BadLength | 7008 - The string is too long
TP_ErrorCode_BadValue | 7009 - The value is out of range
TP_ErrorCode_NoDib | 7010 - No hDib to save to file
TP_ErrorCode_NoPICFiles | 7011 - Couldn't find PIC files for JPEG write
TP_ErrorCode_NoNetFiles | 7012 - Couldn't find wininet files for FTP write
TP_ErrorCode_Ftp | 7013 - FTP error
TP_ErrorCode_TSeqError | 7014 - Illegal operation for current Source Manager or Source state
TP_ErrorCode_BadIndex | 7015 - Index out of range
TP_ErrorCode_WrongCapType | 7016 - Invalid property for current capability
TP_ErrorCode_Clipboard | 7017 - Error copying data to clipboard
TP_ErrorCode_BadBitDepth | 7019 - Invalid bit depth for file type
TP_ErrorCode_NotAvailable | 7020 - Property or method not available
TP_ErrorCode_NoImage | 7021 - No hImage to save to file or access
TP_ErrorCode_DSInvalidOp | 7022 - Data Source performed an illegal operation
TP_ErrorCode_InvalidLicense | 7023 - Invalid license
TP_ErrorCode_TiffTagNotFound | 7024 - TIFF tag not found
TP_ErrorCode_TiffTagItemNotFound | 7025 - TIFF tag item not found
TP_ErrorCode_FileRead | 7026 - File read error
TP_ErrorCode_InternalError | 7018 - Internal error
TP_ErrorCode_SettingsFileInit | 7027 - Initial file settings error
TP_ErrorCode_SettingsFileTerm | 7028 - Error terminating the settings file reader system
TP_ErrorCode_FileNotOpen | 7029 - File not open
TP_ErrorCode_NameNotFound | 7030 - Name not found
TP_ErrorCode_ScannerNotFound | 7031 - Scanner not found
TP_ErrorCode_EnumNotFound | 7032 - Enumeration not found
TP_ErrorCode_InvalidFilename | 7033 - Invalid file name
TP_ErrorCode_FileNotFound | 7034 - File not found
TP_ErrorCode_PathNotFound | 7035 - Path not found
TP_ErrorCode_FileInUse | 7036 - File in use
TP_ErrorCode_FileClose | 7037 - File close
TP_ErrorCode_FileReset | 7038 - File reset
TP_ErrorCode_TypeNotFound | 7039 - Type not found


TP_EvaluationMode Enumeration

Description

Defines named constants for control of trial and full license TwainPRO editions.

Members

Member | Description
TP_EvaluationModeAutomatic | 0 - Automatic evaluation mode. When possible, this component will automatically detect that it is running without a user interface and switch to another evaluation mode. Otherwise, it will display the evaluation mode dialog box.
TP_EvaluationModeTimeout | 1 - Timeout evaluation mode. This is the appropriate evaluation mode for applications that have no user interface.

Remarks

See EvalMode property.


TP_ExtendedInfo Enumeration

Description

Option values for use in specifying capabilities.

Members

Member | Description
TWEI_BARCODEX | Barcode x value
TWEI_BARCODEY | Barcode y value
TWEI_BARCODETEXT | Barcode text
TWEI_BARCODETYPE | Barcode type
TWEI_DESHADETOP | Deshade top
TWEI_DESHADELEFT | Deshade left
TWEI_DESHADEHEIGHT | Deshade height
TWEI_DESHADEWIDTH | Deshade width
TWEI_DESHADESIZE | Deshade size
TWEI_SPECKLESREMOVED | Speckles removed
TWEI_HORZLINEXCOORD | Horizontal line x coordinate
TWEI_HORZLINEYCOORD | Horizontal line y coordinate
TWEI_HORZLINELENGTH | Horizontal line length
TWEI_HORZLINETHICKNESS | Horizontal line thickness
TWEI_VERTLINEXCOORD | Vertical line x coordinate
TWEI_VERTLINEYCOORD | Vertical line y coordinate
TWEI_VERTLINELENGTH | Vertical line length
TWEI_VERTLINETHICKNESS | Vertical line thickness
TWEI_PATCHCODE | Patch code
TWEI_ENDORSEDTEXT | Endorsed text
TWEI_FORMCONFIDENCE | Form confidence
TWEI_FORMTEMPLATEMATCH | Form template match
TWEI_FORMTEMPLATEPAGEMATCH | Form template page match
TWEI_FORMHORZDOCOFFSET | Form horizontal offset
TWEI_FORMVERTDOCOFFSET | Form vertical offset
TWEI_BARCODECOUNT | Barcode count
TWEI_BARCODECONFIDENCE | Barcode confidence
TWEI_BARCODEROTATION | Barcode rotation
TWEI_BARCODETEXTLENGTH | Barcode text length
TWEI_DESHADECOUNT | Deshade count
TWEI_DESHADEBLACKCOUNTOLD | Deshade black count old
TWEI_DESHADEBLACKCOUNTNEW | Deshade black count new
TWEI_DESHADEBLACKRLMIN | Deshade black right left minimum
TWEI_DESHADEBLACKRLMAX | Deshade black right left maximum
TWEI_DESHADEWHITECOUNTOLD | Deshade white count old
TWEI_DESHADEWHITECOUNTNEW | Deshade white count new
TWEI_DESHADEWHITERLMIN | Deshade white right left minimum (4644)
TWEI_DESHADEWHITERLAVE | Deshade white right left average
TWEI_DESHADEWHITERLMAX | Deshade white right left maximum
TWEI_BLACKSPECKLESREMOVED | Black speckles removed
TWEI_WHITESPECKLESREMOVED | White speckles removed
TWEI_HORZLINECOUNT | Horizontal line count
TWEI_VERTLINECOUNT | Vertical line count
TWEI_DESKEWSTATUS | Deskew status
TWEI_SKEWORIGINALANGLE | Skew original angle
TWEI_SKEWFINALANGLE | Skew final angle
TWEI_SKEWCONFIDENCE | Skew confidence
TWEI_SKEWWINDOWX1 | Skew window x1
TWEI_SKEWWINDOWY1 | Skew window y1
TWEI_SKEWWINDOWX2 | Skew window x2
TWEI_SKEWWINDOWY2 | Skew window y2
TWEI_SKEWWINDOWX3 | Skew window x3
TWEI_SKEWWINDOWY3 | Skew window y3
TWEI_SKEWWINDOWX4 | Skew window x4
TWEI_SKEWWINDOWY4 | Skew window y4
TWEJ_NONE | none
TWEJ_MIDSEPARATOR | Mid separator
TWEJ_PATCH1 | Patch 1
TWEJ_PATCH2 | Patch 2
TWEJ_PATCH3 | Patch 3
TWEJ_PATCH4 | Patch 4
TWEJ_PATCH6 | Patch 6
TWEJ_PATCHT | Patch T


TP_ExtInfoConstants Enumeration

Description

Specifies valid values for use in specifying capabilities.

Members

Member | Description
TWBT_3OF9 | TWEI_BARCODETYPE values ("3 of 9") (0)
TWBT_2OF5INTERLEAVED | 2 of 5 Interleaved (1)
TWBT_2OF5NONINTERLEAVED | 2 of 5 Non-interleaved (2)
TWBT_CODE93 | Code 93 (3)
TWBT_CODE128 | Code 128 (4)
TWBT_UCC128 | UCC 128 (5)
TWBT_CODABAR | Codabar (6)
TWBT_UPCA | UPCA (7)
TWBT_UPCE | UPCE (8)
TWBT_EAN8 | EAN8 (9)
TWBT_EAN13 | EAN13 (10)
TWBT_POSTNET | Postnet (11)
TWBT_PDF417 | PDF417 (12)
TWBT_2OF5INDUSTRIAL | 2 of 5 Industrial (13)
TWBT_2OF5MATRIX | 2 of 5 Matrix (14)
TWBT_2OF5DATALOGIC | 2 of 5 Datalogic (15)
TWBT_2OF5IATA | 2 of 5 IATA (16)
TWBT_3OF9FULLASCII | 3 of 9 Full ASCII (17)
TWBT_CODABARWITHSTARTSTOP | Codabar with Start/Stop (18)
TWBT_MAXICODE | Maxicode (19)
TWDSK_SUCCESS | TWEI_DESKEWSTATUS values ("Success") (0)
TWDSK_REPORTONLY | Report Only (1)
TWDSK_FAIL | Fail (2)
TWDSK_DISABLED | Disabled (3)
TWPCH_PATCH1 | TWEI_PATCHCODE values ("Patch 1") (0)
TWPCH_PATCH2 | Patch 2 (1)
TWPCH_PATCH3 | Patch 3 (2)
TWPCH_PATCH4 | Patch 4 (3)
TWPCH_PATCH6 | Patch 6 (4)
TWPCH_PATCHT | Patch T (5)
TWBCOR_ROT0 | TWEI_BARCODEROTATION values (BCOR_ means barcode rotation) ("Rotation 0") (0)
TWBCOR_ROT90 | Rotation 90 (1)
TWBCOR_ROT180 | Rotation 180 (2)
TWBCOR_ROT270 | Rotation 270 (3)
TWBCOR_ROTX | Rotation X (4)


TP_HorizontalAlignment Enumeration

Description

Contains constants for use with the HAlign property.

Members

Member | Description
TP_HorizontalAlignment_Left | Left Justify (0)
TP_HorizontalAlignment_Right | Right Justify (1)
TP_HorizontalAlignment_Center | Center (2)


TP_Orientation Enumeration

Description

Option values which determine the ICAP_ORIENTATION capability.

Members

Member | Description
TWOR_ROT0 | Rotation 0 (0)
TWOR_ROT90 | Rotation 90 (1)
TWOR_ROT180 | Rotation 180 (2)
TWOR_ROT270 | Rotation 270 (3)
TWOR_PORTRAIT | Portrait (0)
TWOR_LANDSCAPE | Landscape (3)


TP_SaveFileType Enumeration

Description

Option values which determine the file type to save as.

Members

Member | Description
TP_SaveFileType_Default | The default file type.
TP_SaveFileType_Tiff | Save file as a tiff
TP_SaveFileType_Bmp | Save file as a bitmap (BMP)
TP_SaveFileType_Jpeg | Save file as a jpeg
TP_SaveFileType_Pic | Save file as a PIC (Pegasus Imaging Corporation)
TP_SaveFileType_Pdf | Save file as a PDF


TP_SaveJBIG2EncodeModeCompression Enumeration

Description

Option values which determine the encoding mode to use when creating a JBIG2 compressed file.

Members

Member | Description
TP_SaveJBIG2EncodeModeCompression_AutoDetect | Default, Lossless generic MQ.
TP_SaveJBIG2EncodeModeCompression_LosslessGenericMQ | Fast, great lossless compression, use for any content, uses MQ arithmetic coding.
TP_SaveJBIG2EncodeModeCompression_LosslessGenericMMR | Fast, very good lossless compression, use for any content, similar to G4 coding, uses Huffman/MMR coding.
TP_SaveJBIG2EncodeModeCompression_LosslessTextMQ | Great lossless compression possible, use for text or symbols, uses MQ arithmetic coding.
TP_SaveJBIG2EncodeModeCompression_LosslessTextMMR | Very good lossless compression possible, use for text or symbols, uses Huffman/MMR coding.
TP_SaveJBIG2EncodeModeCompression_LosslessTextSPM_MQ | Potentially the best lossless compression for text or symbols, uses MQ arithmetic coding.
TP_SaveJBIG2EncodeModeCompression_LosslessTextSPM_MMR | Potentially the best lossless compression for text or symbols, uses Huffman/MMR coding plus MQ arithmetic coding.
TP_SaveJBIG2EncodeModeCompression_LossyTextMQ | Great lossy compression for text or symbols, uses MQ arithmetic coding.
TP_SaveJBIG2EncodeModeCompression_LossyTextMMR | Very good lossy compression for text or symbols, uses Huffman/MMR coding.
TP_SaveJBIG2EncodeModeCompression_LossyHalftoneMQ | Good lossy compression for halftones, uses MQ arithmetic coding
TP_SaveJBIG2EncodeModeCompression_LossyHalftoneMMR | Good lossy compression for halftones, uses Huffman/MMR coding

Remarks

Text regions can be encoded as lossless or as lossy according to the encoding mode specified. The lossy modes use the value in LoosenessCompression to control how loose to be when matching symbols and thereby increase compression and reduce file size. Compression means loss, however, and a consequence of higher compression is an increased risk of errors in the reconstructed image.

Specify a larger value of looseness to reduce the compressed file size; use a smaller value to reduce the errors, if any. Halftone regions can be encoded lossy by specifying one of the lossy halftone encoding modes. Alternatively, they can be encoded lossless by using the lossless generic encoding mode.


TP_SaveJBIG2FileOrgCompression Enumeration

Description

Option values which determine the file organization when saving a JBIG2 compressed file.

Members

Member | Description
TP_SaveJBIG2FileOrgCompression_Default | Default, sequential organization
TP_SaveJBIG2FileOrgCompression_Sequential | Sequential organization
TP_SaveJBIG2FileOrgCompression_RandomAccess | Random access organization

Remarks

A JBIG2 compressed file may be organized in two ways: sequential or random access. Sequential organization is intended for streaming applications, where the decoder reads and decodes the file in order as the data is received. Random access organization permits the decoder to know the entire file structure, without having to read the entire file, and then uses that information to access the required data in a random-access fashion. This organization is useful for applications such as decoding only odd-number pages.


TP_SavePDFCompressionType Enumeration

Description

Option values which determine the PDF compression type.

Members

Member | Description
TP_SavePDFCompressionType_Uncompressed | No compression
TP_SavePDFCompressionType_CCITTFAX3 | CCITT Group 3 one-dimensional fax compression
TP_SavePDFCompressionType_CCITTFAX3_2D | CCITT Group 3 two-dimensional fax compression
TP_SavePDFCompressionType_CCITTFAX4 | CCITT Group 4 fax compression
TP_SavePDFCompressionType_JBIG2 | JBIG2 compression format
TP_SavePDFCompressionType_SequentialJPEG | JPEG compression format
TP_SavePDFCompressionType_Default | Default compression


TP_SaveTIFFCompressionType Enumeration

Description

Contains constants for use with the SaveTIFFCompression property.

Members

Member | Description
TP_SaveTIFFCompressionType_Uncompressed | Uncompressed (0)
TP_SaveTIFFCompressionType_CCITTRLE | CCITT RLE (1)
TP_SaveTIFFCompressionType_CCITTFAX3 | CCITT Group 3 Fax (2)
TP_SaveTIFFCompressionType_CCITTFAX3_2D | CCITT Group 3 2D Fax (3)
TP_SaveTIFFCompressionType_CCITTFAX4 | CCITT Group 4 Fax (4)


TP_SubSample Enumeration

Description

Contains constants for use with the SaveJPEGSubSampling property.

Members

Member | Description
TP_SubSample_111 | (0) - SubSample 111
TP_SubSample_211 | (1) - SubSample 211
TP_SubSample_411 | (2) - SubSample 411
TP_SubSample_211v | (3) - SubSample 211v

Remarks

The default value is TP_SubSample_411.

The value 111 provides the highest image quality with lower compression, while the default 411 provides the best compression with lower image quality.


TP_SupportedSizes Enumeration

Description

Contains constants for use with the TWCAP_SUPPORTEDSIZES capability.

Members

Member | Description
TWSS_NONE | (0) - Supported size none
TWSS_A4LETTER | (1) - Supported size A4 letter
TWSS_B5LETTER | (2) - Supported size B5 letter
TWSS_USLETTER | (3) - Supported size US letter
TWSS_USLEGAL | (4) - Supported size US legal
TWSS_A5 | (5) - Supported size A5
TWSS_B4 | (6) - Supported size B4
TWSS_B6 | (7) - Supported size B6
TWSS_USLEDGER | (9) - Supported size US ledger
TWSS_USEXECUTIVE | (10) - Supported size US executive
TWSS_A3 | (11) - Supported size A3
TWSS_B3 | (12) - Supported size B3
TWSS_A6 | (13) - Supported size A6
TWSS_C4 | (14) - Supported size C4
TWSS_C5 | (15) - Supported size C5
TWSS_C6 | (16) - Supported size C6
TWSS_4A0 | (17) - Supported size 4A0
TWSS_2A0 | (18) - Supported size 2A0
TWSS_A0 | (19) - Supported size A0
TWSS_A1 | (20) - Supported size A1
TWSS_A2 | (21) - Supported size A2
TWSS_A4 | (1) - Supported size A4
TWSS_A7 | (22) - Supported size A7
TWSS_A8 | (23) - Supported size A8
TWSS_A9 | (24) - Supported size A9
TWSS_A10 | (25) - Supported size A10
TWSS_ISOB0 | (26) - Supported size ISOB0
TWSS_ISOB1 | (27) - Supported size ISOB1
TWSS_ISOB2 | (28) - Supported size ISOB2
TWSS_ISOB3 | (12) - Supported size ISOB3
TWSS_ISOB4 | (6) - Supported size ISOB4
TWSS_ISOB5 | (29) - Supported size ISOB5
TWSS_ISOB6 | (7) - Supported size ISOB6
TWSS_ISOB7 | (30) - Supported size ISOB7
TWSS_ISOB8 | (31) - Supported size ISOB8
TWSS_ISOB9 | (32) - Supported size ISOB9
TWSS_ISOB10 | (33) - Supported size ISOB10
TWSS_JISB0 | (34) - Supported size JISB0
TWSS_JISB1 | (35) - Supported size JISB1
TWSS_JISB2 | (36) - Supported size JISB2
TWSS_JISB3 | (37) - Supported size JISB3
TWSS_JISB4 | (38) - Supported size JISB4
TWSS_JISB5 | (2) - Supported size JISB5
TWSS_JISB6 | (39) - Supported size JISB6
TWSS_JISB7 | (40) - Supported size JISB7
TWSS_JISB8 | (41) - Supported size JISB8
TWSS_JISB9 | (42) - Supported size JISB9
TWSS_JISB10 | (43) - Supported size JISB10
TWSS_C0 | (44) - Supported size C0
TWSS_C1 | (45) - Supported size C1
TWSS_C2 | (46) - Supported size C2
TWSS_C3 | (47) - Supported size C3
TWSS_C7 | (48) - Supported size C7
TWSS_C8 | (49) - Supported size C8
TWSS_C9 | (50) - Supported size C9
TWSS_C10 | (51) - Supported size C10
TWSS_USSTATEMENT | (52) - Supported size US statement
TWSS_BUSINESSCARD | (53) - Supported size Business Card


TP_TransferMode Enumeration

Description

Contains constants for use with the TransferMode property.

Members

Member | Description
TWSX_NATIVE | Native Transfer Mode (0)
TWSX_MEMORY | Buffered Memory Transfer Mode (2, not 1)


TP_VerticalAlignment Enumeration

Description

Contains constants for use with the VAlign property.

Members

Member | Description
TP_VerticalAlignment_Top | Top Justify (0)
TP_VerticalAlignment_Bottom | Bottom Justify (1)
TP_VerticalAlignment_Center | Center (2)


Glossary

A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z


Documentation Overview

Description

Pegasus Imaging TwainPro Control 5.0

Projects

Project | Description
PegasusImagingActiveXTwainPro5Lib | Pegasus Imaging TwainPro Control 5.0


Project Overview

Description

Pegasus Imaging TwainPro Control 5.0

Classes

Class Module | Description
TwainPro | TwainPro Class

Public Enumerations

Enumeration | Description
TP_AdvancedCapability | Specifies valid values for use in specifying capabilities.
TP_Capability | Specifies valid values for use in specifying capabilities for the Capability property.
TP_CapAdvConstants | Specifies valid values for use in specifying capabilities.
TP_CapConstants | Option values for use in specifying capabilities.
TP_CapType | Option values for use in specifying capabilities for the CapType and CapTypeOut properties.
TP_ChoiceType | Option values which determine the Twain choice type.
TP_ConditionCode | Option values for specifying extended error information.
TP_DebugErrorLevel | Option values which determine the error level of items to place into the debug log.
TP_ErrorCode | Specifies valid values for error codes.
TP_EvaluationMode | Defines named constants for control of trial and full license TwainPRO editions.
TP_ExtendedInfo | Option values for use in specifying capabilities.
TP_ExtInfoConstants | Specifies valid values for use in specifying capabilities.
TP_HorizontalAlignment | Contains constants for use with the HAlign property.
TP_Orientation | Option values which determine the ICAP_ORIENTATION capability.
TP_SaveFileType | Option values which determine the file type to save as.
TP_SaveJBIG2EncodeModeCompression | Option values which determine the encoding mode to use when creating a JBIG2 compressed file.
TP_SaveJBIG2FileOrgCompression | Option values which determine the file organization when saving a JBIG2 compressed file.
TP_SavePDFCompressionType | Option values which determine the PDF compression type.
TP_SaveTIFFCompressionType | Contains constants for use with the SaveTIFFCompression property.
TP_SubSample | Contains constants for use with the SaveJPEGSubSampling property.
TP_SupportedSizes | Contains constants for use with the TWCAP_SUPPORTEDSIZES capability.
TP_TransferMode | Contains constants for use with the TransferMode property.
TP_VerticalAlignment | Contains constants for use with the VAlign property.


Enumerations Members

Enumerations Object

For a list of all members defined in this module, see Enumerations members.

See Also

Enumerations Members


Enumerations Overview

Enumerations Object Members

See Also

Enumerations Overview