ComPDFKit Web SDK
    Preparing search index...

    Class Scale

    Measurement scale: pageScale on the page corresponds to worldScale in the real world.

    Index
    • Creates a scale. [[1, 'in'], [2, 'ft']], '1 in = 2 ft' and { pageScale, worldScale } are equivalent.

      Parameters

      • scale: string | ScaleRatio | { pageScale: ScaleUnit; worldScale: ScaleUnit }

        Scale as a ratio array, a 'value unit = value unit' string, or a pageScale / worldScale object.

        • string
        • ScaleRatio
        • { pageScale: ScaleUnit; worldScale: ScaleUnit }
          • pageScale: ScaleUnit

            Length on the page and its unit.

          • worldScale: ScaleUnit

            Corresponding real-world length and its unit.

      • Optionalprecision: number

        Precision of measured values; 0.01 means two decimals.

      Returns Scale

    • Formats by precision: decimal getFormattedValue(1.2345, 'ft', 0.01) → '1.23 ft'; inches and feet-inches use fractions when the precision is 1/8, 1/16, 1/32 or 1/64: (2.0833, 'in', 0.125) → '2 ⅛"', (2.0833, 'ft-in', 0.125) → '2'-1"'; feet-inches with decimals is '2ft-1.00in'. With useUnicodeFraction false, fractions are written as 1/8 (standard fonts cannot draw characters such as ⅛); with showZero true, zero inches are written too ('2 0', '2ft-0.00in').

      Parameters

      • value: number
      • unit: string
      • Optionalprecision: number
      • OptionaluseUnicodeFraction: boolean
      • OptionalshowZero: boolean

      Returns string

    • Returns the scale as a ratio array.

      Returns ScaleRatio

      [[pageValue, pageUnit], [worldValue, worldUnit]].

    • Both sides have a positive value and a unit.

      Returns boolean

    • Returns the scale as text.

      Returns string

      A string such as '1 in = 2 ft'.

    pageScale: ScaleUnit

    Length on the page and its unit. Value 0 and an empty unit when the input could not be parsed.

    precision?: number

    Precision of measured values; 0.01 means two decimals.

    worldScale: ScaleUnit

    Real-world length and its unit. Value 0 and an empty unit when the input could not be parsed.