API referenceCore SDK

pdfGetViewport

Enumerate the viewports registered on an arbitrary page (by

C
BOOL32 __stdcall pdfGetViewport(PPDF IPDF, uint32_t PageNum, uint32_t Index, TPDFViewport* VP);
int32_t __stdcall pdfGetViewportCount(PPDF IPDF, uint32_t PageNum);
Delphi
function pdfGetViewport(const IPDF: PPDF; PageNum, Index: Cardinal; var VP: TPDFViewport): LongBool; stdcall;
function pdfGetViewportCount(const IPDF: PPDF; PageNum: Cardinal): Integer; stdcall;

Purpose. Enumerate the viewports registered on an arbitrary page (by PageNum, not necessarily the currently-open one — unlike pdfCreateViewport, which always targets the current page).

Description. pdfGetViewport fills VP.NameA/NameW (both — a proper dual-encoding output, via SetUsageNameBuf) and VP.BBox, and additionally mints GAP-7 object-descriptor handles for VP.Measure (only if the viewport actually has an attached /Measure dict) and VP.PtData (only if it has attached point-data) — both left as their zero/unset value when the corresponding sub-object doesn't exist, rather than minting an always-present-but-empty descriptor.

Parameters.

ParameterDescription
IPDFDocument handle.
PageNum1-based page (any page, not just the current one).
Index0-based viewport index on that page.
VPOutput: NameA/NameW, BBox, and conditionally Measure/PtData object descriptors.

Return value. pdfGetViewport: True if PageNum/Index resolve. pdfGetViewportCount: the viewport count on that page; 0 if out of range.

See also. pdfGetMeasureObj.

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
[return: MarshalAs(UnmanagedType.Bool)]
Area
Core SDK
Category

Getters

Exported names

pdfGetViewport

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.