Clase TScanner - Interface de escaneo

alvaro533
Posts: 206
Joined: Sat Apr 19, 2008 10:28 pm
Location: Madrid, España

Clase TScanner - Interface de escaneo

Post by alvaro533 »

Hola,

Image

Usando la clase de Rafa Carmona TScan, he hecho un interface que permite seleccionar, arrastrando con el ratón, un cuadrado dentro de la imagen previa y escanear sólo esa parte. Luego, se puede crear un fichero pdf multipágina, con todas las páginas escaneadas. Las selecciones se guardan en un fichero ini para el siguiente uso.

Cada página que se escanea nos pide confirmación si la borramos o la añadimos al pdf que estamos creando. La compresión que se consigue es bastante buena.

Image


Image

Luego nos permite gestionar el directorio y el nombre del fichero desde el programa, para así asignar, por ejemplo, facturas escaneadas a un registro del una base de datos de facturas.

En breve subo un link con las fuentes. Para crear el pdf multipágina hago una llamada a nconvert, que es muy rápido y totalmente automático. nconvert es freeware para uso no comercial.
http://xnview.com/en/nconvert.html

Alvaro
p.s. Gracias a Rafael por compartir su clase.
Last edited by alvaro533 on Wed Sep 23, 2009 9:13 pm, edited 3 times in total.
User avatar
Daniel Garcia-Gil
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita
Contact:

Re: Clase TScanner

Post by Daniel Garcia-Gil »

Alvaro...

Excelente.... ante magnifica exposicion y descripcion solo queda compartir en ejemplo funcional para saber como lo haces :mrgreen:
our best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
alvaro533
Posts: 206
Joined: Sat Apr 19, 2008 10:28 pm
Location: Madrid, España

Re: Clase TScanner

Post by alvaro533 »

Aquí está:

http://www.box.net/shared/sov0hjb6t2

Basado en la clase de TScan de Rafael Carmona.

Compilar con el proyecto:

QScanner2.prg
TSCAN.prg (no usar la TSCAN.lib porque creo que he modificado algo en la clase de Rafael)
a_scan.prg
Taq_selearea.prg

con

QScanner2.rc (solo el icono)
Qscanner2.ch

y enlazar TWAIN.LIB

En el directorio de la apliación necesitamos:

EZTW32.dll
Freeimage.dll
nconvert.exe

Un saludo,

Alvaro
alvaro533
Posts: 206
Joined: Sat Apr 19, 2008 10:28 pm
Location: Madrid, España

Re: Clase TScanner

Post by alvaro533 »

Se me olvidaba, el pdf mantiene el la escala del documento escaneado. Lo he tenido que hacer con nconvert, porque la clase del scanner no controlaba los DPI de la imagen. Es decir, si se imprime desde Adobe acrobat o Foxit con escala al 100%, se conserva en tamaño original del documento. Esto es útil si se escanean documentos con formatos pequeños.

Alvaro
User avatar
Andrés González
Posts: 629
Joined: Thu Jan 19, 2006 10:45 am
Location: Mallorca

Re: Clase TScanner - Interface de escaneo

Post by Andrés González »

Excelente contribución, muy buen trabajo Alvaro. Seguro que Rafa estará contento de que su clase este dando tan excelentes resultados. Enhorabuena a los dos.
Saludos

Andrés González desde Mallorca
User avatar
fespinoza
Posts: 188
Joined: Wed Feb 01, 2006 6:59 pm
Location: Ecuador

Re: Clase TScanner - Interface de escaneo

Post by fespinoza »

Alvaro

Estoy probando con tu ejemplo, enlazando a una aplicación mía, pero al compilar y enlazar tsacn.prg me sale este error repetido para todas las funciones harbour (creo). Incluí los 4 .prg y la libreria Twain.lib.

Code: Select all | Expand

Compilado y Enlazado de: [C:\Sicef_xH\SicefWin.Exe]Ejecución No. 6Ejecutada a las: 09:43:12============================================================FATAL: No fué encontrado C:\Sicef_xH\Bin\SicefWin.RCxHarbour Compiler build 1.2.1 (SimpLex) (Rev. 6406)Copyright 1999-2009, http://www.xharbour.org http://www.harbour-project.org/Compiling 'C:\Sicef_xH\Bin\tscan.prg'...Lines 279, Functions/Procedures 8Generating C source output to 'C:\Sicef_xH\Obj\tscan.hrb'...Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 BorlandC:\Sicef_xH\Obj\tscan.hrb:Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 296: Call to function'TWAIN_Acquire' with no prototype in function HB_FUN_TW_ACQUIREWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 322: Call to function'TWAIN_AcquireMemory' with no prototype in function HB_FUN_TW_ACQUIREMEMORYWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 332: Call to function'TWAIN_AcquireFile' with no prototype in function HB_FUN_TW_ACQUIREFILEWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 355: Call to function'TWAIN_SourceName' with no prototype in function HB_FUN_TW_SOURCENAMEError E2342 C:\\Sicef_xH\\Bin\\tscan.prg 355: Type mismatch in parameter'szText' (wanted 'const signed char *', got 'int') in functionHB_FUN_TW_SOURCENAMEWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 360: Call to function'TWAIN_GetSourceName' with no prototype in function HB_FUN_TW_GETSOURCENAMEWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 369: Call to function'DIB_WriteToJpeg' with no prototype in function HB_FUN_TW_DIBWJPGWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 374: Call to function'DIB_WriteToBmp' with no prototype in function HB_FUN_TW_DIBWBMPWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 382: Call to function'TWAIN_IsJpegAvailable' with no prototype in function HB_FUN_TW_ISJPGWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 387: Call to function'TWAIN_SetSaveFormat' with no prototype in function HB_FUN_TW_SETSAVEFORMATWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 392: Call to function'TWAIN_GetSaveFormat' with no prototype in function HB_FUN_TW_GETSAVEFORMATWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 397: Call to function'TWAIN_SetJpegQuality' with no prototype in function HB_FUN_TW_SETJPEGQUALITYWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 403: Call to function'TWAIN_GetJpegQuality' with no prototype in function HB_FUN_TW_GETJPEGQUALITYWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 421: Call to function'TWAIN_SetMultiTransfer' with no prototype in functionHB_FUN_TW_SETMULTITRANSFERWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 427: Call to function'TWAIN_GetMultiTransfer' with no prototype in functionHB_FUN_TW_GETMULTITRANSFERWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 444: Call to function'TWAIN_DisableParent' with no prototype in function HB_FUN_TW_DISABLEPARENTWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 450: Call to function'TWAIN_GetDisableParent' with no prototype in functionHB_FUN_TW_GETDISABLEPARENTWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 464: Call to function'TWAIN_SetAppTitle' with no prototype in function HB_FUN_TW_SETAPPTITLEWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 490: Call to function'TWAIN_GetSourceList' with no prototype in function HB_FUN_TW_GETSOURCELISTWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 495: Call to function'TWAIN_GetNextSourceName' with no prototype in functionHB_FUN_TW_GETNEXTSOURCENAMEWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 500: Call to function'TWAIN_GetDefaultSourceName' with no prototype in functionHB_FUN_TW_GETDEFAULTSOURCENAMEWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 505: Call to function'TWAIN_OpenSource' with no prototype in function HB_FUN_TW_OPENSOURCEWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 586: Call to function'TWAIN_SetXResolution' with no prototype in function HB_FUN_TW_SETXRESOLUTIONWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 591: Call to function'TWAIN_SetYResolution' with no prototype in function HB_FUN_TW_SETYRESOLUTIONWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 606: Call to function'TWAIN_SetThreshold' with no prototype in function HB_FUN_TW_SETTHRESHOLDWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 611: Call to function'TWAIN_GetCurrentThreshold' with no prototype in functionHB_FUN_TW_GETCURRENTTHRESHOLDWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 626: Call to function'TWAIN_SupportsFileXfer' with no prototype in functionHB_FUN_TW_SUPPORTSFILEXFERWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 631: Call to function'TWAIN_SetPaperSize' with no prototype in function HB_FUN_TW_SETPAPERSIZEWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 638: Call to function'TWAIN_HasFeeder' with no prototype in function HB_FUN_TW_HASFEEDERWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 643: Call to function'TWAIN_IsFeederSelected' with no prototype in functionHB_FUN_TW_ISFEEDERSELECTEDWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 648: Call to function'TWAIN_SelectFeeder' with no prototype in function HB_FUN_TW_SELECTFEEDERWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 653: Call to function'TWAIN_IsAutoFeedOn' with no prototype in function HB_FUN_TW_ISAUTOFEEDONWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 658: Call to function'TWAIN_SetAutoFeed' with no prototype in function HB_FUN_TW_SETAUTOFEDDWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 663: Call to function'TWAIN_IsFeederLoaded' with no prototype in function HB_FUN_TW_ISFEEDERLOADEDWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 669: Call to function'TWAIN_GetDuplexSupport' with no prototype in functionHB_FUN_TW_GETDUPLEXSUPPORTWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 674: Call to function'TWAIN_EnableDuplex' with no prototype in function HB_FUN_TW_ENABLEDUPLEXWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 679: Call to function'TWAIN_IsDuplexEnabled' with no prototype in function HB_FUN_TW_ISDUPLEXENABLEDWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 686: Call to function'TWAIN_HasControllableUI' with no prototype in functionHB_FUN_TW_HASCONTROLLABLEUIWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 691: Call to function'TWAIN_SetIndicators' with no prototype in function HB_FUN_TW_SETINDICATORSWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 696: Call to function'TWAIN_Compression' with no prototype in function HB_FUN_TW_COMPRESSIONWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 701: Call to function'TWAIN_SetCompression' with no prototype in function HB_FUN_TW_SETCOMPRESSIONWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 706: Call to function 'TWAIN_Tiled'with no prototype in function HB_FUN_TW_TILEDWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 711: Call to function'TWAIN_SetTiled' with no prototype in function HB_FUN_TW_SETTILEDWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 716: Call to function'TWAIN_PlanarChunky' with no prototype in function HB_FUN_TW_PLANARCHUNKYWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 721: Call to function'TWAIN_SetPlanarChunky' with no prototype in function HB_FUN_TW_SETPLANARCHUNKYWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 726: Call to function'TWAIN_PixelFlavor' with no prototype in function HB_FUN_TW_PIXELFLAVORWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 731: Call to function'TWAIN_SetPixelFlavor' with no prototype in function HB_FUN_TW_SETPIXELFLAVORWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 736: Call to function'TWAIN_SetLightPath' with no prototype in function HB_FUN_TW_SETLIGHTPATHWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 741: Call to function'TWAIN_SetAutoBright' with no prototype in function HB_FUN_TW_SETAUTOBRIGHTWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 746: Call to function'TWAIN_SetGamma' with no prototype in function HB_FUN_TW_SETGAMMAWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 751: Call to function'TWAIN_SetShadow' with no prototype in function HB_FUN_TW_SETSHADOWWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 756: Call to function'TWAIN_SetHighlight' with no prototype in function HB_FUN_TW_SETHIGHLIGHTWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 763: Call to function'TWAIN_SetImageLayout' with no prototype in function HB_FUN_TW_SETIMAGELAYOUTWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 768: Call to function'TWAIN_ResetImageLayout' with no prototype in functionHB_FUN_TW_RESETIMAGELAYOUTWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 777: Call to function'TWAIN_GetImageLayout' with no prototype in function HB_FUN_TW_GETIMAGELAYOUTWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 791: Call to function'TWAIN_GetDefaultImageLayout' with no prototype in functionHB_FUN_TW_GETDEFAULTIMAGELAYOUTWarning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 803: Call to function'DIB_GetFromClipboard' with no prototype in functionHB_FUN_TW_DIB_GETFROMCLIPBOARD*** 1 errors in Compile ***MAKE Version 5.2  Copyright (c) 1987, 2000 Borland** error 1 ** deleting C:\Sicef_xH\Obj\tscan.objHa habido ERRORES al intentar Generar la Aplicacion============================================================VERCE v5.0+ -> Ver Resultados de Compilación y Enlazado v5.0+Juan Carlos Salinas Ojedajcso@hotmail.comMinatitlán, Veracruz. MEXICOY Solo Veracruz es bello !!!William Morales [wmormar]wmormar@yahoo.com.mxTabasco, tierra del eden mexicanoFiveWin for Harbour!! 



Saludos

fernando Espinoza
Saludos

Fernando Espinoza
alvaro533
Posts: 206
Joined: Sat Apr 19, 2008 10:28 pm
Location: Madrid, España

Re: Clase TScanner - Interface de escaneo

Post by alvaro533 »

Hola Fernando,

Pues no te puedo decir. Las funciones a las que hace referencia el error son las que están contenidas en twain.lib. Yo uso Harbour, no lo he probado con XHarbour, pero debería funcionar.

Un saludo

Alvaro
User avatar
thefull
Posts: 731
Joined: Fri Oct 07, 2005 7:42 am
Location: Barcelona
Contact:

Re: Clase TScanner - Interface de escaneo

Post by thefull »

Oh!!! Que grande! A ver si saco un tiempo y miro como implementaste la solución.
Saludos
Rafa Carmona ( rafa.thefullARROBAgmail.com___quitalineas__)
User avatar
jose_murugosa
Posts: 1188
Joined: Mon Feb 06, 2006 4:28 pm
Location: Uruguay
Contact:

Re: Clase TScanner - Interface de escaneo

Post by jose_murugosa »

Hola,

La verdad que la clase está excelente.

FELICITACIONES.

Como vi que algunos compañeros no pudieron compilarla apropiadamente, incluyo este archivo comprimido donde están los archivos .vrc (verce) para hacer la compilación y además un archivito .h que faltaba que pertenece a la clase de Rafa Carmona, y es necesario para compilar.

Espero sea de ayuda y sobre todo no sea mal interpretado.

Sea todo el crédito a sus autores.

http://www.box.net/shared/vhl11vvj47
Saludos/Regards,
José Murugosa
"Los errores en programación, siempre están entre la silla y el teclado y la IA!!"
User avatar
fespinoza
Posts: 188
Joined: Wed Feb 01, 2006 6:59 pm
Location: Ecuador

Re: Clase TScanner - Interface de escaneo

Post by fespinoza »

Gracias a Thefull, Alvaro y José, ahora funciona perfecto y me es de gran utilidad.
Saludos

Fernando Espinoza
alvaro533
Posts: 206
Joined: Sat Apr 19, 2008 10:28 pm
Location: Madrid, España

Re: Clase TScanner - Interface de escaneo

Post by alvaro533 »

thefull wrote:Oh!!! Que grande! A ver si saco un tiempo y miro como implementaste la solución.


Gracias Rafa por la clase original. No me había fijado que el nick "Thefull" eras tu.

Alvaro
Enrrique Vertiz
Posts: 562
Joined: Fri Oct 07, 2005 2:17 pm
Location: Lima - Peru
Been thanked: 3 times
Contact:

Clase TScanner - Interface de escaneo - Jose Murugosa

Post by Enrrique Vertiz »

Saludos Jose, hace algun tiempo subiste esta clase a internet con el ejemplo que hizo Alvaro, estoy tratando de bajarla de internet pero el Link al que hace referencia ya no es valido, podrias pr favor subirlo nuevamente o indicarme desde donde la puedo bajar, MUCHAS GRACIAS
Enrrique Vertiz Pitta
Lima-Peru
xHb 1.23.1026X, Fwh 25.01, BCC74, MySQL 8.0.X, SQLLIB 1.9m
User avatar
AIDA
Posts: 879
Joined: Fri Jan 12, 2007 8:35 pm

Re: Clase TScanner - Interface de escaneo

Post by AIDA »

se ve muy bonito :D

Gracias :mrgreen:

Saluditos :wink:
Que es mejor que programar? creo que nada :)
Atropellada pero aqui ando :P

I love Fivewin

séʌǝɹ ןɐ ɐʇsǝ opunɯ ǝʇsǝ
User avatar
Bayron
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA

Re: Clase TScanner - Interface de escaneo

Post by Bayron »

Gracias Alvaro, Rafa, y a todos por compartir con nosotros su grandioso trabajo.

Yo al menos tengo mucho que agraceder a todo el foro, que de una u otra manera han contribuído para que yo vaya aprendiendo, y ejemplos como estos, nos facilitan la vida a los que no podemos tanto....
=====>

Bayron Landaverry
(215)2226600 Philadelphia,PA, USA
+(502)46727275 Guatemala
MayaBuilders@gMail.com

FWH12.04||Harbour 3.2.0 (18754)||BCC6.5||UEstudio 10.10||
Windows 7 Ultimate

FiveWin, One line of code and it's done...
Ruben Fernandez
Posts: 366
Joined: Wed Aug 30, 2006 5:25 pm
Location: Uruguay

Re: Clase TScanner - Interface de escaneo

Post by Ruben Fernandez »

Excelente como siempre, Gracias Alvaro y Gracias Rafa.

Que seria de mi sin este foro........

Saludos Ruben Fernandez
Post Reply