AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Funciones WLanguage / Funciones estándar / Funciones de Windows / Funciones TWAIN
  • Document coming from the Twain device
  • Managing the type of image
  • Duplex scanner
  • Modo de funcionamiento en las aplicaciones de 64 bits
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
Allows:
  • save the document coming from the Twain device in a PDF file.
  • view the document coming from the Twain device in the device UI. The user can perform any of the actions proposed by this interface (e.g. save the document, change the device's default settings). The available actions depend on the device used.
  • save the document coming from the Twain device directly in memory in PDF format (in a buffer).
Ejemplo
// Acquisition as long as there are pages to load
TwainToPDF("File.PDF")
// Save the document found in the scanner in memory
// The document will be saved in black and white
IMG_MyImage = TwainToPDF(inMemory, False, TwainBlackWhite)
Sintaxis

Save and display the document coming from the Twain device in a PDF file Ocultar los detalles

<Result> = TwainToPDF([<PDF file> [, <User interface> [, <Type of image> [, <Number of bits per pixel> [, <Image resolution> [, <Image contrast> [, <Image brightness> [, <Duplex mode> [, <Automatic load>]]]]]]]]])
<Result>: Boolean
  • True if the document was saved or viewed,
  • False if the document was not saved. The corresponding error message is returned by ErrorInfo.
<PDF file>: Optional character string
Name and full or relative path of the file (up to 260 characters). The file extension is optional. A UNC path can be used.
If this parameter is not specified or is an empty string (""), the user will have to enter the full name of the PDF file in a file picker.
<User interface>: Optional boolean
  • True if the user interface of Twain device must be displayed. When saving a document, the <PDF file> will be proposed by default.
  • False (default value) if the user interface of Twain device must not be displayed.
<Type of image>: Optional Integer constant (or combination of constants)
Type of image used to save the document (classified by order of color management):
Order for managing the colors
0 (Default value)Default device image.
1TwainPaletteImage whose colors are issued from a palette.
2TwainRGBRGB image.
3TwainGrayScaleGrayscale image.
4TwainBlackWhiteBlack and white image.
-TwainAnyTypeAny type of image.

If these constants are combined, the best type of image supported by the device will be selected (according to the order of color management). For more details, see the remarks.
The default type of image will be used:
  • if this parameter is not specified or corresponds to 0.
  • if the specified type of image is not supported by the device.
  • if <User interface> is set to True.
<Number of bits per pixel>: Optional integer
Amount of information about the colors (to display or print each pixel in an image). The larger the number of bits per pixel, the sharper the color rendering will be.
The possible values for this parameter depend on the type of image used:
Type of imagePossible values
Colored image issued from a palette (TwainPalette constant).1, 4 or 8
RGB image (TwainRGB constant).8, 10 or 16
Grayscale image (TwainGrayScale constant).8 or 16
Image in black and white (TwainBlackWhite constant).1

If this parameter is not specified, the default number of bits per pixel will be used.
<Image resolution>: Optional real
Number of pixels per inch (the possible values depend on the device used).
The default image resolution will be used:
  • if this parameter is not specified or corresponds to 0.
  • if the specified resolution is not supported by the device.
  • if <User interface> is set to True.
<Image contrast>: Optional real
Contrast of the image (value included between -1000 and 1000).
The default image contrast will be used:
  • if this parameter is not specified or corresponds to 0.
  • if the specified contrast is not supported by the device.
  • if <User interface> is set to True.
<Image brightness>: Optional real
Brightness of the image (value included between -1000 and 1000).
The default image brightness will be used:
  • if this parameter is not specified or corresponds to 0.
  • if the specified brightness is not supported by the device.
  • if <User interface> is set to True.
<Duplex mode>: Optional boolean
  • True to scan a document on both sides,
  • False (by default) to scan the document on a single side.
<Automatic load>: Optional boolean
True to automatically load the pages in the device. All the pages found in the scanner loader are scanned in a single PDF file.
Note: Without a feeder, to scan multiple pages in a single PDF file, you need to scan each page in a PDF file and then use the PDFMerge function.

Saving the document from the Twain device in memory in PDF format Ocultar los detalles

<Result> = TwainToPDF(<InMemory> [, <User interface> [, <Type of image> [, <Number of bits per pixel> [, <Image resolution> [, <Image contrast> [, <Image brightness> [, <Duplex mode> [, <Automatic load>]]]]]]]])
<Result>: Buffer
Byte string containing the document in PDF format.
Then this byte string can be assigned to an Image control, saved in a file (fSaveBuffer), sent via a network (with the Socket functions), etc.
<InMemory>: Constant
inMemorySaves the document from the Twain device in memory.
<User interface>: Optional boolean
  • True if the user interface of Twain device must be displayed.
  • False (default value) if the user interface of Twain device must not be displayed.
<Type of image>: Optional Integer constant (or combination of constants)
Type of image used to save the document (classified by order of color management):
Order for managing the colors
0 (Default value)Default device image.
1TwainPaletteImage whose colors are issued from a palette.
2TwainRGBRGB image.
3TwainGrayScaleGrayscale image.
4TwainBlackWhiteBlack and white image.
-TwainAnyTypeAny type of image.

If these constants are combined, the best type of image supported by the device will be selected (according to the order of color management). For more details, see the remarks.
The default type of image will be used:
  • if this parameter is not specified or corresponds to 0.
  • if the specified type of image is not supported by the device.
  • if <User interface> is set to True.
<Number of bits per pixel>: Optional integer
Amount of information about the colors (to display or print each pixel in an image). The larger the number of bits per pixel, the sharper the color rendering will be.
The possible values for this parameter depend on the type of image used:
Type of imagePossible values
Colored image issued from a palette (TwainPalette constant).1, 4 or 8
RGB image (TwainRGB constant).8, 10 or 16
Grayscale image (TwainGrayScale constant).8 or 16
Image in black and white (TwainBlackWhite constant).1

If this parameter is not specified, the default number of bits per pixel will be used.
<Image resolution>: Optional real
Number of pixels per inch (the possible values depend on the device used).
The default image resolution will be used:
  • if this parameter is not specified or corresponds to 0.
  • if the specified resolution is not supported by the device.
  • if <User interface> is set to True.
<Image contrast>: Optional real
Contrast of the image (value included between -1000 and 1000).
The default image contrast will be used:
  • if this parameter is not specified or corresponds to 0.
  • if the specified contrast is not supported by the device.
  • if <User interface> is set to True.
<Image brightness>: Optional real
Brightness of the image (value included between -1000 and 1000).
The default image brightness will be used:
  • if this parameter is not specified or corresponds to 0.
  • if the specified brightness is not supported by the device.
  • if <User interface> is set to True.
<Duplex mode>: Optional boolean
  • True to scan a document on both sides,
  • False (by default) to scan the document on a single side.
<Automatic load>: Optional boolean
True to automatically load the pages in the device. All the pages found in the scanner loader are scanned in a single PDF file.
Note: Without a feeder, to scan multiple pages in a single PDF file, you need to scan each page in a PDF file and then use the PDFMerge function.
Observaciones

Document coming from the Twain device

The "document coming from the Twain device" corresponds to:
  • the document in the scanner when TwainToPDF is called. In this case, the parameters specified in TwainScanArea are taken into account.
  • the image transmitted by a "Web camera" when TwainToPDF is called.
  • the first photo saved in a digital camera.
    Note: If user interface is used, the document retrieved will correspond to the photograph selected by the user.. If several photos are selected, only the first selected photo will be retrieved.

Managing the type of image

If several constants are combined in <Type of image>, the best type of image supported by the device will be selected (according to the order of color management).
For example: If this parameter corresponds to TwainBlackWhite + TwainRVBthe image type will be:
  • RGB if this type is supported by the device.
  • black and white otherwise.

Duplex scanner

If the scanner supports the duplex mode, you have the ability to perform a double-sided scan. The generated document contains both sides of the scanned document.
Note Depending on the hardware used, the Twain driver may not be sufficient for duplex scanning. You may have to install additional drivers supplied by the manufacturer.

Modo de funcionamiento en las aplicaciones de 64 bits

En una aplicación de 64 bits, esta función utilizará automáticamente el Driver Twain de 64 bits. El TWAIN no se puede utilizar si este Driver no está instalado.
Clasificación Lógica de negocio / UI: Lógica de negocio
Componente: wd300std.dll
Versión mínima requerida
  • Versión 19
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 27/03/2025

Señalar un error o enviar una sugerencia | Ayuda local