L_TwainSetImageUnit

Summary

Sets the image unit value used to transfer images from the current TWAIN source.

Syntax

#include "lttwn.h"

L_LTTWN_API L_INT L_TwainSetImageUnit(hSession, nUnit)

Parameters

HTWAINSESSION hSession

Handle to an existing TWAIN session. This handle is obtained by calling the L_TwainInitSession or L_TwainInitSession2 function.

L_INT nUnit

Specifies the unit value to set. For more information on possible values, refer to the TWAIN specification.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

This function internally sets the image unit capability ICAP_UNITS. For more information on this capability, refer to the TWAIN specification.

To obtain the current image unit value, call the L_TwainGetImageUnit function

This function should be called after calling the L_TwainStartCapsNeg function and before calling the L_TwainEndCapsNeg function.

Required DLLs and Libraries

See Also

Functions

Topics

Example

L_INT TwainSetImageUnitExample(HTWAINSESSION hSession)  
{ 
 
   L_INT nRet = SUCCESS; 
 
   nRet = L_TwainStartCapsNeg (hSession); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   L_INT nUnit; 
   nRet = L_TwainGetImageUnit (hSession, &nUnit); 
   if (nRet == SUCCESS) 
   { 
      if (nUnit != TWUN_INCHES) 
      { 
         nRet = L_TwainSetImageUnit(hSession, TWUN_INCHES); 
         if(nRet != SUCCESS) 
            return nRet; 
      } 
   } 
   else 
      return nRet; 
 
   L_INT nBPP; 
   nRet = L_TwainGetImageBitsPerPixel (hSession, &nBPP); 
   if (nRet == SUCCESS) 
   { 
      if (nBPP != 24) 
      { 
         nRet = L_TwainSetImageBitsPerPixel (hSession, 24); 
         if(nRet != SUCCESS) 
            return nRet; 
      } 
   } 
   else 
      return nRet; 
 
   nRet = L_TwainEndCapsNeg (hSession); 
   if(nRet != SUCCESS) 
      return nRet; 
   return SUCCESS; 
} 
Help Version 22.0.2022.12.7
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS TWAIN C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.