ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 ImageEn 13.0: Scanning with AcquireParams class
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Stalker4

Ukraine
32 Posts

Posted - Jan 16 2025 :  05:40:04  Show Profile  Reply
Hi,

Delphi 12.1, ImageEn 13.0.

1) Do I understand correctly that if I need specific properties of TWAIN or WIA interfaces (read/write) when working with AcquireParams, I can access them. specific properties of TWAIN or WIA interfaces (read/write), they can be accessed in the following way can be accessed in the following way:
with ImageEnMView.MIO do 
   if AcquireParams.SelectedSource.API = ieaTwain then
     AcquireParams.AttachedTwainParams.Brightness.CurrentValue := 50
  else
  if AcquireParams.SelectedSource.API = ieaWIA then begin
    AcquireParams.AttachedWIAParams.GetItemPropertyAttrib(WIA_IPS_BRIGHTNESS, AcquireParams.AttachedWIAParams.Device, ieAttrib, ieValues);
    nMin := ieValues.Min
  end;

2) The TWAIN interface has AcceptedImages and StandardSize properties for setting the number of sheets and sheet size.
The WIA interface or TAcquireParams does not have these properties.
Question: WIA interface does not support these features (properties) or they are not implemented in your system ?

3) When saving the scan result to PDF
with ImageEnMView.MIO do
   for nCou := 0 to ImageEnMView.ImageCount-1 do begin
     Params[nCou].PDF_Compression := ioPDF_JPEG;
     Params[nCou].PDF_Creator := 'My Creater';
   end;

 ImageEnMView.MIO.SaveToStreamPDF(FStream);
There are string properties, e.g. PDF_Creator or PDF_Author.
Question: In which encoding of them are the string data written to PDF ?
I need to understand how to write Cyrillic encoded strings to these fields.

xequte

38754 Posts

Posted - Jan 16 2025 :  19:43:06  Show Profile  Reply
Hi

1. Yes, you can either use the AcquireParams properties which set the Twain/WIA properties, or you can set them directly via AttachedTwainParams/AttachedWIAParams. The result will be the same.

2. I would need to research the equivalent properties in WIA

3. At this time, only ANSI strings are supported

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

Stalker4

Ukraine
32 Posts

Posted - Jan 17 2025 :  03:50:57  Show Profile  Reply
2) Your answer is clear, but I find it strange that the WIA interface has no properties for page size or number of sheets of paper, it turns out that there are scanners with automatic sheet feeder, but it is impossible to control the number of sheets through WIA ....

3) Then there is a suggestion, if possible, to add properties for Unicode string format there.
Go to Top of Page

xequte

38754 Posts

Posted - Jan 17 2025 :  18:32:59  Show Profile  Reply
2. In WIA 2.0 there is a page size property, WIA_IPS_PAGE_SIZE, but we have not implemented that yet. You could implement it using:

https://www.imageen.com/help/TIEWia.GetDeviceProperty.html
https://www.imageen.com/help/TIEWia.SetDeviceProperty.html


3. Yes, we have it on our to-do list.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

Stalker4

Ukraine
32 Posts

Posted - Jan 22 2025 :  01:19:54  Show Profile  Reply
Where to get the constants to set the paper size for the SetDeviceProperty method ?

I mean constants like IETW_NONE, IETW_A3, IETW_A4, IETW_A5, IETW_A6, but for WIA.
Go to Top of Page

xequte

38754 Posts

Posted - Jan 22 2025 :  20:04:50  Show Profile  Reply
Hi

Please email us for the latest beta. We have added an experimental AcquireParams.StandardSize property. You pass Twain page consts to it, but it works for both Twain and WIA.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

Stalker4

Ukraine
32 Posts

Posted - Jan 23 2025 :  04:00:29  Show Profile  Reply
Hi,

These constants can be used for SetDeviceProperty(WIA_DPS_PAGE_SIZE, ) ?

By the way, do I understand correctly that WIA_DPS_PAGES is used to set the number of pages to scan, for example SetDeviceProperty(WIA_DPS_PAGES, -1) or SetDeviceProperty(WIA_DPS_PAGES, 5) ?
If I'm right, you could add a property for the AcquireParams interface for this as well.
Go to Top of Page

xequte

38754 Posts

Posted - Jan 23 2025 :  15:28:14  Show Profile  Reply
Sorry, I cannot find an order for you. Can you email me your details.

I've added AcquireCount which supports WIA_DPS_PAGES, but this is also marked as Experimental as we do not have adequate devices to test it on.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

Stalker4

Ukraine
32 Posts

Posted - Jan 24 2025 :  03:08:17  Show Profile  Reply
Sent you a reply to your e-mail via your forum profile.

These constants (IETW_NONE, IETW_A3, IETW_A4, IETW_A5, IETW_A6) can be used for SetDeviceProperty(WIA_DPS_PAGE_SIZE, ) ?
Go to Top of Page

xequte

38754 Posts

Posted - Jan 24 2025 :  03:17:53  Show Profile  Reply
Thanks, I've replied to your email.

WIA_DPS_PAGE_SIZE is deprecated, you should use WIA_IPS_PAGE_SIZE.

You cannot use the Twain constants for that. The WIA constants are:

https://learn.microsoft.com/en-us/windows/win32/wia/-wia-wia2-pagesizeconstants



Nigel
Xequte Software
www.imageen.com
Go to Top of Page

Stalker4

Ukraine
32 Posts

Posted - Jan 24 2025 :  03:58:21  Show Profile  Reply
I read your letter.

Where to get the numerical value for WIA_IPS_PAGE_SIZE and WIA_IPS_PAGES ?

P.S. According to the documentation you gave me a link to (thank you very much for that), WIA_DPS_PAGES is not supported in WIndows Vista and higher.
Go to Top of Page

xequte

38754 Posts

Posted - Jan 25 2025 :  13:01:28  Show Profile  Reply
Sorry, I'm out of the office this week. You should just google the values.


Nigel
Xequte Software
www.imageen.com
Go to Top of Page

Stalker4

Ukraine
32 Posts

Posted - Jan 27 2025 :  02:38:30  Show Profile  Reply
The codes for the constants WIA_IPS_PAGE_SIZE and WIA_IPS_PAGES were found on the Internet.
#define WIA_IPS_PAGES                              3096 // 0xc18
#define WIA_IPS_PAGES_STR                          L"Pages"

#define WIA_IPS_PAGE_SIZE                          3097 // 0xc19
#define WIA_IPS_PAGE_SIZE_STR                      L"Page Size"

I made a small modification to your demo "AllAcquire": I added Edit1 (TEdit) to the form and added this code to the end of the SaveProperties procedure:
if ImageEnMView1.MIO.AcquireParams.SelectedSource.API = ieaTwain then
  ImageEnMView1.MIO.AcquireParams.AttachedTwainParams.AcceptedImages := StrToInt(Edit1.Text)
else
if ImageEnMView1.MIO.AcquireParams.SelectedSource.API = ieaWIA then
  ImageEnMView1.MIO.AcquireParams.AttachedWIAParams.SetDeviceProperty(3096, StrToInt(Edit1.Text));

I made a small modification to your demo “AllAcquire”: I added Edit1 (TEdit) to the form and added this code to the end of the SaveProperties procedure:

1) I enter in Edit1 the number 2, that is, that would scan only 2 pages, I select the TWAIN-driver, Duplex mode is disabled, I press the “Acquire” button.

The scanner loaded ALL the sheets of paper that were in the sheet holder, but the program itself (in ImageEnMView1) transferred only 2 sheets.

The fact that the scanner loaded ALL sheets of paper despite the “AcceptedImages” property being set, is this how it should be ?

2) I enter in Edit1 the number 2, i.e. to scan only 2 pages, select WIA-driver, Duplex mode is disabled, press “Acquire” button.

The scanner loaded all sheets of paper that were in the sheet holder, and in the program itself (in ImageEnMView1) transferred also ALL sheets.

So it turns out that the code did not work at all for WIA.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: