BOOL32 __stdcall pdfGetViewport(PPDF IPDF, uint32_t PageNum, uint32_t Index, TPDFViewport* VP);
int32_t __stdcall pdfGetViewportCount(PPDF IPDF, uint32_t PageNum);
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.
| Parameter | Description |
|---|---|
IPDF | Document handle. |
PageNum | 1-based page (any page, not just the current one). |
Index | 0-based viewport index on that page. |
VP | Output: 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)
[return: MarshalAs(UnmanagedType.Bool)]
Getters
pdfGetViewport
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.