PdfMeasurementScale class
A measurement calibration the editing UI carries: how many real-world units one PDF point represents, the unit label, and the display precision. Persisted in PdfEditingPreferences so a drawing's scale survives reopening the file.
Build one directly, or from a calibration gesture with PdfMeasurementScale.fromReference: the user draws a segment of known real length, and the scale is its real length divided by its page-space length.
- Annotations
Constructors
- PdfMeasurementScale({required double unitsPerPoint, required String unitLabel, String pageUnitLabel = 'in', String? areaUnitLabel, int precision = 100})
-
const
- PdfMeasurementScale.fromReference({required double pointLength, required double realLength, required String unitLabel, String pageUnitLabel = 'in', String? areaUnitLabel, int precision = 100})
-
Calibrates from a reference segment of
pointLengthPDF points that representsrealLengthunitLabels.pageUnitLabelis the on-page reference unit the ratio is quoted against ('in', 'cm', 'mm').factory
Properties
- areaUnitLabel → String?
-
The area unit label, or null to default to
unitLabel².final - hashCode → int
-
The hash code for this object.
no setteroverride
- pageUnitLabel → String
-
The on-page reference unit the scale is quoted against - the
left-hand side of the
1 <pageUnit> = N <unit>ratio ('in', 'cm', 'mm'). Defaults to inches, the traditional drawing-scale reference.final - precision → int
-
The display precision passed to
PdfNumberFormat(nearest1 / precision).final - ratioLabel → String
-
A short user-facing label, e.g.
1 in = 20 ftor1 cm = 5 m, quoted against pageUnitLabel as the on-page reference unit.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- unitLabel → String
-
The distance unit label ('ft', 'm', ...).
final
- unitsPerPoint → double
-
Real-world units per PDF point.
final
Methods
-
encode(
) → String -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toMeasure(
) → PdfMeasure - The /Measure dictionary model this scale stamps onto annotations.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
Static Methods
-
decode(
String source) → PdfMeasurementScale? -
fromMeasure(
PdfMeasure measure) → PdfMeasurementScale -
Recovers a scale from a document-borne
PdfMeasure(a page /VP viewport's /Measure, or an annotation's), so the editor can adopt the drawing scale a reopened or shared file already carries. The on-page reference unit isn't stored in /Measure, so it defaults to inches.