AddPageMeasureViewport

Page properties, Measurement and coordinate units

Description

Appends a rectilinear measurement viewport (/VP) with a /Subtype /RL measure dictionary to the selected page per ISO 32000-1 §12.9

Syntax

Delphi

Function AddPageMeasureViewport(Left, Bottom, Right, Top, ScaleRatio: Double; Const UnitLabel, Name: WideString): Integer;

ActiveX

Function PDFlib::AddPageMeasureViewport(Left As Double, Bottom As Double, Width As Double, Height As Double, ScaleRatio As Double, UnitLabel As String, Name As String) As Long

DLL

int DLAddPageMeasureViewport(int InstanceID, double Left, double Bottom, double Width, double Height, double ScaleRatio, const wchar_t* UnitLabel, const wchar_t* Name);
int DLAddPageMeasureViewportA(int InstanceID, double Left, double Bottom, double Width, double Height, double ScaleRatio, const char* UnitLabel, const char* Name);

Parameters

LeftHorizontal coordinate of the viewport bounding box
BottomVertical coordinate of the viewport bounding box
RightAbsolute right coordinate of the viewport bounding box in PDF user space; legacy facade parameter name Width
TopAbsolute top coordinate of the viewport bounding box in PDF user space; legacy facade parameter name Height
ScaleRatioWorld units per PDF user-space unit (must be positive)
UnitLabelMeasurement unit label (defaults to m when empty)
NameOptional viewport name written to /Name

Return values

A nonzero viewport handle when the viewport was appended, or 0 when the page is unavailable or ScaleRatio is non-positive

Remarks

The DLL and ActiveX Width and Height labels are retained for compatibility, but their values are absolute Right and Top coordinates, not extents; dimensions are not validated by this method

Creates a /Type /Viewport dictionary with /BBox and a /Measure dictionary of /Subtype /RL containing /R, /X, /D and /A number format arrays

Automatically ensures the document version is at least PDF 1.6

See also

AddLGIDictToPage, GetPageViewPortCount