This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Wednesday, July 22, 2009 10:40:51 PM(UTC)
Groups: Registered
Posts: 2
To Fit the image i make use of the PaintSizeMode property, but this property has no option to fit only the height of the image. I made a workaround to fit the height, but then sometimes a small border is displayed on the bottom of the image, see attachment, because LeadTools property PaintZoomFactor is an Integer and not a Real property like it should be, look at Adobe Reader that can also set Real zoompercentage. I program with Delphi 7 and use LEADTools Raster Imaging 14.5 dll. The workaround code:
var
zoomFactor: Integer;
zoomPercent: Real;
Viewer: TLEADImage;
begin
...
ftHeight:
begin
if (DoGetPageOrientation = 0) or (DoGetPageOrientation = 180) then
begin
if (Viewer.Width / Viewer.Height) > (Viewer.InfoWidth / Viewer.InfoHeight) then
Viewer.PaintSizeMode := smFit
else
begin
Viewer.PaintSizeMode := smZoom;
zoomPercent := (Viewer.Height - 3)* 100 / Viewer.InfoHeight;
DoSetPageZoomPercent(ContainerViewer, zoomPercent);
end;
end;
if (DoGetPageOrientation = 90) or (DoGetPageOrientation = 270) then
begin
if (Viewer.Width / Viewer.Height) > (Viewer.InfoHeight / Viewer.InfoWidth) then
Viewer.PaintSizeMode := smFit
else
begin
Viewer.PaintSizeMode := smZoom;
zoomPercent := ((Viewer.Height - 15) / Viewer.InfoWidth) * 100;
DoSetPageZoomPercent(ContainerViewer, zoomPercent);
end;
end;
end;
...
end;
Anybody suggestions?
idtCapture1 attached the following image(s):
#2
Posted
:
Thursday, July 23, 2009 6:37:24 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
If you want to have more accurate control over the display, you can manipulate the destination rectangle to exact pixel values instead of using an integer zoom factor.
For example, if you want to take into consideration a horizontal scrollbar when you fit the height, you can use code like this in the ELSE clause:
begin
Viewer.AutoScroll := False;
calcHeight := Viewer.Height - Viewer.HScrollInfo.Width;
calcWidth := Viewer.BitmapWidth * calcHeight div Viewer.BitmapHeight;
Viewer.SetDstRect(0, 0, calcWidth, calcHeight);
Viewer.AutoScroll := True
end
where both variables calcWidth and calcHeight are integers.
#3
Posted
:
Friday, July 31, 2009 4:52:48 AM(UTC)
Groups: Registered
Posts: 2
Thanks Basel, i adpated your code a bit and got it working now.
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.