API referenceRendering & Viewer

rasGetCurrZoom

Get/set the page cache's zoom factor.

C
float __stdcall rasGetCurrZoom(IPGC CachePtr);
BOOL32 __stdcall rasZoom(IPGC CachePtr, float Value, int32_t* HorzPos, int32_t* VertPos);
Delphi
function rasGetCurrZoom(CachePtr: IPGC): Single; stdcall;
function rasZoom(CachePtr: IPGC; Value: Single; var HorzPos, VertPos: Integer): LongBool; stdcall;

Purpose. Get/set the page cache's zoom factor.

Description. rasZoom's behavior branches on the sign of Value: a positive value sets an explicit zoom (C.Zoom := Value) and switches the page-scale mode to psFitZoom (explicit-zoom mode); a non-positive value instead resets C.Zoom := 0 and switches mode to psFitWidth — i.e. rasZoom(CachePtr, 0, ...) is a "re-fit to width" command, not a literal "set zoom to zero." Either way it clears the render cache (ClearRenderCache, forcing a re-render at the new scale) and echoes the (unchanged) current scroll position back through HorzPos/VertPos — this call does not itself adjust scroll to keep any particular point centered/anchored under the zoom change.

Parameters.

ParameterDescription
CachePtrTarget page cache.
Value> 0: explicit zoom factor (switches to psFitZoom). ≤ 0: re-fit-to-width request (psFitWidth, Zoom reset to 0 pending recompute).
HorzPos, VertPosOutput: the (unchanged) current ScrollX/ScrollY, echoed back.

Return value. rasGetCurrZoom: current zoom (0.0 if CachePtr doesn't resolve). rasZoom: True if CachePtr resolves.

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
public static extern float rasGetCurrZoom(IntPtr CachePtr);
Area
Rendering & Viewer
Category

Rasterizer/Rendering

Exported names

rasGetCurrZoom

String variants

The …A form takes UTF-8, …W takes UTF-16; a bare name aliases the ANSI form.

See working code

Worked examples — complete programs in ten languages.