API referenceRendering & Viewer

rasGetWidthHeight

Two independent, standalone page-size calculators that

C
void __stdcall rasCalcPagePixelSize(IPGE PagePtr, TPDFPageScale DefScale, float Scale, uint32_t FrameWidth, uint32_t FrameHeight, TRasterFlags Flags, uint32_t* Width, uint32_t* Height);
BOOL32 __stdcall rasGetWidthHeight(IPGE PagePtr, TRasterFlags Flags, float* Width, float* Height, int32_t Rotate, void** BBox);
Delphi
procedure rasCalcPagePixelSize(PagePtr: IPGE; DefScale: TPDFPageScale; Scale: Single; FrameWidth, FrameHeight: Cardinal; Flags: TRasterFlags; var Width, Height: Cardinal); stdcall;
function rasGetWidthHeight(PagePtr: IPGE; Flags: TRasterFlags; var Width, Height: Single; Rotate: Integer; BBox: PPointer): LongBool; stdcall;

Purpose. Two independent, standalone page-size calculators that don't require a page cache at all — both take a raw IPGE page pointer.

Description. rasCalcPagePixelSize computes pixel dimensions for a given fit mode: psFitWidth/psFitHeight scale to the supplied FrameWidth/FrameHeight; psFitBest picks the smaller of the two resulting scales (true "fit within frame"); anything else (psFitZoom) honors the explicit Scale parameter directly. rasGetWidthHeight instead reports the page's own natural size, rotated by the effective rotation (Rotate if >= 0, else the page's own stored rotation, with Flags' rfRotate90/180/270 bits additively applied on top, normalized mod 360) — swapping Width/Height for a 90°/270° effective rotation. BBox is accepted by rasGetWidthHeight's ABI but never read — there is no box-selection (media/crop/trim/bleed/ art) here, unlike the document-level pdfGetBBox/pdfSetBBox family (Page Lifecycle and Geometry) which genuinely honors a Boundary parameter.

Parameters.

ParameterDescription
PagePtrRaw page pointer (not a cache/document handle).
DefScale*(CalcPagePixelSize)* Fit mode; psFitZoom uses Scale directly.
Scale*(CalcPagePixelSize)* Explicit scale, used only for psFitZoom (or as a starting default 1 if ≤ 0).
FrameWidth, FrameHeight*(CalcPagePixelSize)* Target frame for fit modes.
Flags*(WidthHeight)* Additive rotation bits on top of Rotate/the page's own rotation.
Rotate*(WidthHeight)* ≥ 0 overrides the page's own stored rotation.
BBox*(WidthHeight)* Accepted but never read — always reports the page's own default box, no boundary selection.
Width, HeightOutput pixel/point dimensions.

Return value. rasCalcPagePixelSize: none (procedure). rasGetWidthHeight: True if PagePtr resolves to a valid, positive-size page; False otherwise.

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
[return: MarshalAs(UnmanagedType.Bool)]
Area
Rendering & Viewer
Category

Rasterizer/Rendering

Exported names

rasGetWidthHeight

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.