Recent

Author Topic: Using a scanner  (Read 11117 times)

Kyjan

  • New Member
  • *
  • Posts: 41
Using a scanner
« on: March 25, 2011, 10:43:04 am »
Hi guys,

is there any way to use a scanner through Lazarus? I'm developing a Windows application, so I don't need a cross-platform solution, just a simple one, how can I use the installed scanner on Windows, and save the scanned document in pdf.

Thanks for your help,

Regards,
Kyjan

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: Using a scanner
« Reply #1 on: March 25, 2011, 10:53:28 am »
The apis on Windows used for scanning called Twain and WIA.

Twain is an older type, WIA the newer api (might be COM requiring, and thus needing 2.5.1)

IIRC Jedi had some TWAIN related headers and examples in the past. Searching for "Delphi twain" and "delphi wia" might yield code that can be fairly easily converted.

Specially since FPC comes with the standard Jedi headers. (winunits-jedi pkg which is installed default on windows)

Kyjan

  • New Member
  • *
  • Posts: 41
Re: Using a scanner
« Reply #2 on: March 28, 2011, 08:31:36 am »
marcov, thanks for your answer. As I see, I have to learn more from Lazarus and FreePascal. I guess 2.5.1 means a FP version, am I right? This Delphi-converting thing is a hard thing for me, but I'll try it.

Thanks for your help
Regards
Kyjan

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: Using a scanner
« Reply #3 on: March 28, 2011, 05:25:22 pm »
marcov, thanks for your answer. As I see, I have to learn more from Lazarus and FreePascal. I guess 2.5.1 means a FP version, am I right? This Delphi-converting thing is a hard thing for me, but I'll try it.

Yes, 2.5.1 is the current development branch (aka TRUNK) of FPC. It is a work-in-progress that one day will become 2.6.0.

ssamayoa

  • Full Member
  • ***
  • Posts: 163
Re: Using a scanner
« Reply #4 on: March 27, 2012, 12:24:46 am »
Did you get twain/wia working with your app?

balazsszekely

  • Guest
Re: Using a scanner
« Reply #5 on: April 06, 2021, 12:01:21 pm »
@BeatriceFranklin
Quote
Hello, sorry for my late arrival.
I am looking for a scanning application, anyone have a good suggestion?
On windows you can do it with twain api as marcov already mentioned. I don't think there is a cross platform solution.

balazsszekely

  • Guest
Re: Using a scanner
« Reply #6 on: April 06, 2021, 06:56:21 pm »
I attach a windows only solution(twain). As a side note I don't have a scanner, so I cannot test if the application works or not. More over I only found a 32 bit library.

paweld

  • Hero Member
  • *****
  • Posts: 970
Re: Using a scanner
« Reply #7 on: April 06, 2021, 09:26:08 pm »
Od Delphi Twain http://www.kluug.net/delphitwain.php modified by Ondrej
Best regards / Pozdrawiam
paweld

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1228
Re: Using a scanner
« Reply #8 on: April 07, 2021, 12:59:33 am »
hello,
the message from @BeatriceFranklin seems to have been removed ? 
Quote
Hello, sorry for my late arrival.
I am looking for a scanning application, anyone have a good suggestion?

but i give an answer for linux :
on Linux you have pascalsane using sane library.
the demo project did not work with Lazarus 2.0.12  fpc 3.2 on Ubuntu 20.04
i have modified some files and now it is working (project in attachment) .  I have also installed libsane-dev library.

Friendly, J.P
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1228
Re: Using a scanner
« Reply #9 on: April 07, 2021, 01:11:11 am »
little things :
1 - .lpr file not seen as a valid lpr file
2 - add {$R *.lfm}  and comment {$I demomain.lrs}    in demomain.pas
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: Using a scanner
« Reply #10 on: April 07, 2021, 01:23:25 am »
ah old Laz resources 

 ;)
The only true wisdom is knowing you know nothing

balazsszekely

  • Guest
Re: Using a scanner
« Reply #11 on: April 07, 2021, 06:13:41 am »
@Jurassic Pork
Quote
the message from @BeatriceFranklin seems to have been removed ? 
Probably a spammer, there are a lot of them lately. As a general rule I don't respond to users with less then 10 posts, but I a fell for this one.

Quote
but i give an answer for linux :
on Linux you have pascalsane using sane library.
the demo project did not work with Lazarus 2.0.12  fpc 3.2 on Ubuntu 20.04
i have modified some files and now it is working (project in attachment) .  I have also installed libsane-dev library.
Great! Thanks. Good to know there is an alternative for linux too.

« Last Edit: April 07, 2021, 06:23:51 am by GetMem »

 

TinyPortal © 2005-2018