Clase TScanner - Interface de escaneo

Clase TScanner - Interface de escaneo

Postby alvaro533 » Wed Sep 23, 2009 3:46 pm

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.
alvaro533
 
Posts: 206
Joined: Sat Apr 19, 2008 10:28 pm
Location: Madrid, España

Re: Clase TScanner

Postby Daniel Garcia-Gil » Wed Sep 23, 2009 4:03 pm

Alvaro...

Excelente.... ante magnifica exposicion y descripcion solo queda compartir en ejemplo funcional para saber como lo haces :mrgreen:
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: Clase TScanner

Postby alvaro533 » Wed Sep 23, 2009 5:13 pm

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

Postby alvaro533 » Wed Sep 23, 2009 9:12 pm

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
alvaro533
 
Posts: 206
Joined: Sat Apr 19, 2008 10:28 pm
Location: Madrid, España

Re: Clase TScanner - Interface de escaneo

Postby Andrés González » Thu Sep 24, 2009 7:32 am

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
Andrés González
 
Posts: 627
Joined: Thu Jan 19, 2006 10:45 am
Location: Mallorca

Re: Clase TScanner - Interface de escaneo

Postby fespinoza » Thu Sep 24, 2009 2:54 pm

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 view
Compilado y Enlazado de: [C:\Sicef_xH\SicefWin.Exe]
Ejecución No. 6
Ejecutada a las: 09:43:12
============================================================
FATAL: No fué encontrado C:\Sicef_xH\Bin\SicefWin.RC
xHarbour 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 8
Generating C source output to 'C:\Sicef_xH\Obj\tscan.hrb'...
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
C:\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_ACQUIRE
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 322: Call to function
'TWAIN_AcquireMemory' with no prototype in function HB_FUN_TW_ACQUIREMEMORY
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 332: Call to function
'TWAIN_AcquireFile' with no prototype in function HB_FUN_TW_ACQUIREFILE
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 355: Call to function
'TWAIN_SourceName' with no prototype in function HB_FUN_TW_SOURCENAME
Error E2342 C:\\Sicef_xH\\Bin\\tscan.prg 355: Type mismatch in parameter
'szText' (wanted 'const signed char *', got 'int') in function
HB_FUN_TW_SOURCENAME
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 360: Call to function
'TWAIN_GetSourceName' with no prototype in function HB_FUN_TW_GETSOURCENAME
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 369: Call to function
'DIB_WriteToJpeg' with no prototype in function HB_FUN_TW_DIBWJPG
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 374: Call to function
'DIB_WriteToBmp' with no prototype in function HB_FUN_TW_DIBWBMP
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 382: Call to function
'TWAIN_IsJpegAvailable' with no prototype in function HB_FUN_TW_ISJPG
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 387: Call to function
'TWAIN_SetSaveFormat' with no prototype in function HB_FUN_TW_SETSAVEFORMAT
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 392: Call to function
'TWAIN_GetSaveFormat' with no prototype in function HB_FUN_TW_GETSAVEFORMAT
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 397: Call to function
'TWAIN_SetJpegQuality' with no prototype in function HB_FUN_TW_SETJPEGQUALITY
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 403: Call to function
'TWAIN_GetJpegQuality' with no prototype in function HB_FUN_TW_GETJPEGQUALITY
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 421: Call to function
'TWAIN_SetMultiTransfer' with no prototype in function
HB_FUN_TW_SETMULTITRANSFER
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 427: Call to function
'TWAIN_GetMultiTransfer' with no prototype in function
HB_FUN_TW_GETMULTITRANSFER
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 444: Call to function
'TWAIN_DisableParent' with no prototype in function HB_FUN_TW_DISABLEPARENT
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 450: Call to function
'TWAIN_GetDisableParent' with no prototype in function
HB_FUN_TW_GETDISABLEPARENT
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 464: Call to function
'TWAIN_SetAppTitle' with no prototype in function HB_FUN_TW_SETAPPTITLE
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 490: Call to function
'TWAIN_GetSourceList' with no prototype in function HB_FUN_TW_GETSOURCELIST
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 495: Call to function
'TWAIN_GetNextSourceName' with no prototype in function
HB_FUN_TW_GETNEXTSOURCENAME
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 500: Call to function
'TWAIN_GetDefaultSourceName' with no prototype in function
HB_FUN_TW_GETDEFAULTSOURCENAME
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 505: Call to function
'TWAIN_OpenSource' with no prototype in function HB_FUN_TW_OPENSOURCE
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 586: Call to function
'TWAIN_SetXResolution' with no prototype in function HB_FUN_TW_SETXRESOLUTION
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 591: Call to function
'TWAIN_SetYResolution' with no prototype in function HB_FUN_TW_SETYRESOLUTION
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 606: Call to function
'TWAIN_SetThreshold' with no prototype in function HB_FUN_TW_SETTHRESHOLD
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 611: Call to function
'TWAIN_GetCurrentThreshold' with no prototype in function
HB_FUN_TW_GETCURRENTTHRESHOLD
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 626: Call to function
'TWAIN_SupportsFileXfer' with no prototype in function
HB_FUN_TW_SUPPORTSFILEXFER
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 631: Call to function
'TWAIN_SetPaperSize' with no prototype in function HB_FUN_TW_SETPAPERSIZE
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 638: Call to function
'TWAIN_HasFeeder' with no prototype in function HB_FUN_TW_HASFEEDER
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 643: Call to function
'TWAIN_IsFeederSelected' with no prototype in function
HB_FUN_TW_ISFEEDERSELECTED
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 648: Call to function
'TWAIN_SelectFeeder' with no prototype in function HB_FUN_TW_SELECTFEEDER
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 653: Call to function
'TWAIN_IsAutoFeedOn' with no prototype in function HB_FUN_TW_ISAUTOFEEDON
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 658: Call to function
'TWAIN_SetAutoFeed' with no prototype in function HB_FUN_TW_SETAUTOFEDD
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 663: Call to function
'TWAIN_IsFeederLoaded' with no prototype in function HB_FUN_TW_ISFEEDERLOADED
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 669: Call to function
'TWAIN_GetDuplexSupport' with no prototype in function
HB_FUN_TW_GETDUPLEXSUPPORT
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 674: Call to function
'TWAIN_EnableDuplex' with no prototype in function HB_FUN_TW_ENABLEDUPLEX
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 679: Call to function
'TWAIN_IsDuplexEnabled' with no prototype in function HB_FUN_TW_ISDUPLEXENABLED
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 686: Call to function
'TWAIN_HasControllableUI' with no prototype in function
HB_FUN_TW_HASCONTROLLABLEUI
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 691: Call to function
'TWAIN_SetIndicators' with no prototype in function HB_FUN_TW_SETINDICATORS
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 696: Call to function
'TWAIN_Compression' with no prototype in function HB_FUN_TW_COMPRESSION
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 701: Call to function
'TWAIN_SetCompression' with no prototype in function HB_FUN_TW_SETCOMPRESSION
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 706: Call to function 'TWAIN_Tiled'
with no prototype in function HB_FUN_TW_TILED
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 711: Call to function
'TWAIN_SetTiled' with no prototype in function HB_FUN_TW_SETTILED
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 716: Call to function
'TWAIN_PlanarChunky' with no prototype in function HB_FUN_TW_PLANARCHUNKY
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 721: Call to function
'TWAIN_SetPlanarChunky' with no prototype in function HB_FUN_TW_SETPLANARCHUNKY
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 726: Call to function
'TWAIN_PixelFlavor' with no prototype in function HB_FUN_TW_PIXELFLAVOR
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 731: Call to function
'TWAIN_SetPixelFlavor' with no prototype in function HB_FUN_TW_SETPIXELFLAVOR
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 736: Call to function
'TWAIN_SetLightPath' with no prototype in function HB_FUN_TW_SETLIGHTPATH
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 741: Call to function
'TWAIN_SetAutoBright' with no prototype in function HB_FUN_TW_SETAUTOBRIGHT
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 746: Call to function
'TWAIN_SetGamma' with no prototype in function HB_FUN_TW_SETGAMMA
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 751: Call to function
'TWAIN_SetShadow' with no prototype in function HB_FUN_TW_SETSHADOW
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 756: Call to function
'TWAIN_SetHighlight' with no prototype in function HB_FUN_TW_SETHIGHLIGHT
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 763: Call to function
'TWAIN_SetImageLayout' with no prototype in function HB_FUN_TW_SETIMAGELAYOUT
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 768: Call to function
'TWAIN_ResetImageLayout' with no prototype in function
HB_FUN_TW_RESETIMAGELAYOUT
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 777: Call to function
'TWAIN_GetImageLayout' with no prototype in function HB_FUN_TW_GETIMAGELAYOUT
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 791: Call to function
'TWAIN_GetDefaultImageLayout' with no prototype in function
HB_FUN_TW_GETDEFAULTIMAGELAYOUT
Warning W8065 C:\\Sicef_xH\\Bin\\tscan.prg 803: Call to function
'DIB_GetFromClipboard' with no prototype in function
HB_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.obj
Ha habido ERRORES al intentar Generar la Aplicacion
============================================================
VERCE v5.0+ -> Ver Resultados de Compilación y Enlazado v5.0+
Juan Carlos Salinas Ojeda
jcso@hotmail.com
Minatitlán, Veracruz. MEXICO
Y Solo Veracruz es bello !!!
William Morales [wmormar]
wmormar@yahoo.com.mx
Tabasco, tierra del eden mexicano
FiveWin for Harbour!!
 



Saludos

fernando Espinoza
Saludos

Fernando Espinoza
User avatar
fespinoza
 
Posts: 188
Joined: Wed Feb 01, 2006 6:59 pm
Location: Ecuador

Re: Clase TScanner - Interface de escaneo

Postby alvaro533 » Thu Sep 24, 2009 3:45 pm

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
alvaro533
 
Posts: 206
Joined: Sat Apr 19, 2008 10:28 pm
Location: Madrid, España

Re: Clase TScanner - Interface de escaneo

Postby thefull » Fri Sep 25, 2009 11:42 am

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
thefull
 
Posts: 729
Joined: Fri Oct 07, 2005 7:42 am
Location: Barcelona

Re: Clase TScanner - Interface de escaneo

Postby jose_murugosa » Fri Sep 25, 2009 6:49 pm

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
FWH + Harbour + Bcc7. Una seda!
User avatar
jose_murugosa
 
Posts: 1144
Joined: Mon Feb 06, 2006 4:28 pm
Location: Uruguay

Re: Clase TScanner - Interface de escaneo

Postby fespinoza » Mon Sep 28, 2009 1:26 am

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

Fernando Espinoza
User avatar
fespinoza
 
Posts: 188
Joined: Wed Feb 01, 2006 6:59 pm
Location: Ecuador

Re: Clase TScanner - Interface de escaneo

Postby alvaro533 » Mon Sep 28, 2009 11:48 am

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
alvaro533
 
Posts: 206
Joined: Sat Apr 19, 2008 10:28 pm
Location: Madrid, España

Clase TScanner - Interface de escaneo - Jose Murugosa

Postby Enrrique Vertiz » Thu May 20, 2010 8:19 pm

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 23.04, MySQL 8.0.X, SQLLIB 1.9m, SQLRDD
Enrrique Vertiz
 
Posts: 514
Joined: Fri Oct 07, 2005 2:17 pm
Location: Lima - Peru

Re: Clase TScanner - Interface de escaneo

Postby AIDA » Thu May 20, 2010 9:53 pm

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
AIDA
 
Posts: 877
Joined: Fri Jan 12, 2007 8:35 pm

Re: Clase TScanner - Interface de escaneo

Postby Bayron » Fri May 21, 2010 12:19 am

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...
User avatar
Bayron
 
Posts: 815
Joined: Thu Dec 24, 2009 12:46 am
Location: Philadelphia, PA

Re: Clase TScanner - Interface de escaneo

Postby Ruben Fernandez » Fri May 21, 2010 1:17 am

Excelente como siempre, Gracias Alvaro y Gracias Rafa.

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

Saludos Ruben Fernandez
Ruben Fernandez
 
Posts: 366
Joined: Wed Aug 30, 2006 5:25 pm
Location: Uruguay

Next

Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 96 guests