Scale
A ratio of the size of an object as displayed on a document page to the size of a corresponding real-world object. Scale objects are used for measurement annotations. This class is immutable - you must create a new Scale object if you want to change any of the members.
Constructors
Creates an instance of a measurement Scale object.
Types
Properties
The user-provided string description for the source value, or null if not provided.
String representation of the source scale value. Returns the user-provided fractional input if available, otherwise formats as decimal.
The user-provided string description for the target value, or null if not provided.
String representation of the target scale value. Returns the user-provided fractional input if available, otherwise formats as decimal.
The unit for the source scale value (distance on the PDF page).
The unit for the target scale value (distance in the real world).
Functions
Equality is based on the display string, which includes user-provided descriptions (such as fractional input) or formatted float values. This means that two Scale objects with numerically equivalent values but different string representations (e.g., "3/4" vs "0.75") will not be considered equal. This is intentional, as users may expect the exact input to be preserved. For numeric equivalence, use numericEquals instead.
Compares this Scale to another for numeric equivalence, ignoring string representations. Returns true if the values and units are equal, regardless of input format. For example, Scale.fromStrings("3/4", IN, "1", FT) and Scale(0.75f, IN, 1f, FT) are numerically equal but not equal according to equals.