Page Viewports and Measurement

ISO 32000-1/2 12.9, Tables 260 to 269, define page /VP viewports carrying either /Subtype /RL rectilinear or /Subtype /GEO geospatial measure dictionaries, optionally accompanied by a /PtData /Subtype /Cloud point-data table

Rectilinear viewports

THPDFPage.AddRectilinearViewport(Name, Left, Bottom, Right, Top, ScaleRatio, ConversionFactor, UnitLabel, ...) is the one-call form — one linear and one derived area unit, with the scale ratio text defaulted from the factor — whilst THPDFPage.AddRectilinearViewportEx(Name, ..., Measure) takes the whole THPDFRectilinearMeasureInfo record, with per-axis, distance, area, angle and slope number-format arrays held as THPDFNumberFormatEntry records in THPDFNumberFormatEntryArray values, plus an origin and a change-rate-of-y factor

THotPDF.AddPageRectilinearViewport and THotPDF.AddPageRectilinearViewportEx are the page-index counterparts for a document the caller addresses by number; both need PDF 1.6

THPDFPage.AddGeospatialViewport(Name, Left, Bottom, Right, Top, Measure) and THPDFPage.SetViewportPointDataCloud(ViewportIndex, AttributeNames, FlatPointValues) are the current-page variants of the geospatial and point-data writers, for code that already holds the page instance

Geospatial viewports and point clouds

THotPDF.AddPageGeospatialViewport(PageIndex, Name, BBox..., Measure) writes a PDF 2.0 geospatial measure from the THPDFGeoMeasureInfo record — a THPDFCoordinateSystemInfo coordinate system of THPDFCoordinateSystemType GEOGCS or PROJCS identified by EPSG or WKT, an optional datum shift, linear, area and angular units, bounds, and the paired GIS and page-space tie points

THotPDF.SetPageViewportPointDataCloud(PageIndex, ViewportIndex, AttributeNames, FlatPointValues) attaches the /PtData /Subtype /Cloud dictionary of measured per-point attributes to a viewport that already exists, with the flat values laid out as rows of the attribute list

Reading measures back

THotPDF.GetLoadedPageViewports(PageIndex) hands back every viewport of a loaded page as a THPDFViewportInfo record in a THPDFViewportInfoArray — name, bounding box, measure subtype, the parsed rectilinear or geospatial measure record, and the point-data cloud as a THPDFPointDataCloudInfo whose THPDFPointDataAttributeRow rows carry the measured values

THotPDF.GetLoadedAnnotationMeasure(PageIndex, AnnotationIndex, Subtype, Rectilinear, Geospatial) parses the measure dictionary of the annotation at the given index, which is what dimensioning and scaling annotations — measurement lines and polygons — rely on

THotPDF.AttachLoadedAnnotationMeasure attaches a measure to an annotation