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
 Get max. Papersize for Twain or wia
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Ralf

110 Posts

Posted - Jan 18 2017 :  03:18:42  Show Profile  Reply
Hallo,

is there any way to get the max. Papersize for Twain and Wia?

I only found the AcquireParams.PhysicalWidth and PhysicalHeight.

The only way to find the max. Papersize is to do it on my own and look in the IOPDFPaperSizes Array.

That I have not to make a Copy of the IOPDFPaperSizes I changes the Position of the declaration of the IOPDFPapersizes Array from under the Implemetation in the source to upper.

Have you got a better Idear to solve my problem?

Thanks
Ralf

xequte

38128 Posts

Posted - Jan 19 2017 :  00:21:29  Show Profile  Reply
Hi Ralf

Actually there is not currently an easy method, but it would be good for a coming update.

What code are you using?



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

Ralf

110 Posts

Posted - Jan 19 2017 :  03:12:48  Show Profile  Reply
Hi Nigel

at the moment i go through the IOPDFPapersizes an look if it has the same margins as the Physical-Margins. That i can do that i had to make IOPDFPaperSizes available out of the Unit it is declared.

with ImageEnMio, AcquireParams do
begin
  ScPSizeMax:=-1;
  for i:=0 to length(IOPDFPaperSizes)-1 do
    begin
      with IOPDFPaperSizes[i] do
      begin
        If (Width=PhysicalWidth) and(Height=PhysicalHeight) then
        begin
          case Size of
            iepA3 : ScPSizeMax:=TWSS_A3; *)
            iepA4 : ScPSizeMax:=TWSS_A4;
            iepA5 : ScPSizeMax:=TWSS_A5;
            iepA6 : ScPSizeMax:=TWSS_A6;
          end;
        end;
        if ScPSizeMax<>-1 then Break;
      end;
    end;
    if ScPSizeMax=-1 then ScPSizeMax:=TWSS_A4;
...

*) That are the Const's of our old Imaging Tool. Further on we will change to the ImagenEn Const's.

I Think it would be a good idear if you publish the IOPDFPapersizes in your source code also. For me it save's the work to change it in source for each update and for you i don't see a problem if it is available outside the unit.

Thanks and best Regards

Ralf
Go to Top of Page

xequte

38128 Posts

Posted - Jan 19 2017 :  20:40:46  Show Profile  Reply

Hi Ralf

I don't think that should work.

Physical* values are in units of an inch. Whereas IOPDFPaperSizes dimensions are in PDF points (1/72 of an inch). Also, with our test systems the Physical* values do not align well with page size.

You could do something like:

procedure TfrmMain.btnShowMaxSizeClick(Sender: TObject);
var
  i: Integer;
  maxPageSize: Integer;
begin
  maxPageSize := -1;
  for i := ord( iepA0 ) to ord( iepB5 ) do
  begin
    if ( IOPDFPaperSizes[ i ].Width <= Round(ImageEnMView1.MIO.AcquireParams.PhysicalWidth * 72 )) and
       ( IOPDFPaperSizes[ i ].Height <= Round(ImageEnMView1.MIO.AcquireParams.PhysicalHeight * 72 )) then
    begin
      maxPageSize := i;
      Break;
    end;
  end;
  if maxPageSize > -1  then
    ShowMessage( 'Max Metic Page Size: ' + IEPaperSizeToStr( TIOPDFPaperSize( maxPageSize )))
end;


Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

xequte

38128 Posts

Posted - Jan 19 2017 :  21:28:52  Show Profile  Reply
FYI, for the next update I will add the helper method, IECalcPaperSize():

with ImageEnMView1.MIO do
begin
  lblSizeM := 'Max Paper Size (Metric): + IEPaperSizeToStr( IECalcPaperSize( AcquireParams.PhysicalWidth, AcquireParams.PhysicalHeight, True ));
  lblSizeUS := 'Max Paper Size (US): + IEPaperSizeToStr( IECalcPaperSize( AcquireParams.PhysicalWidth, AcquireParams.PhysicalHeight, False ));
end;


Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: