Note: You must be registered in order to post a reply. To register, click here. Registration is FREE!
T O P I C R E V I E W
Ralf
Posted - Jan 18 2017 : 03:18:42 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
4 L A T E S T R E P L I E S (Newest First)
xequte
Posted - Jan 19 2017 : 21:28:52 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;
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;
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
xequte
Posted - Jan 19 2017 : 00:21:29 Hi Ralf
Actually there is not currently an easy method, but it would be good for a coming update.