code: @SuppressWarnings({"WeakerAccess", "unused"})
     public float  getDocumentAspectRatio()
     {
        if (this.rootElement == null)
           throw new IllegalArgumentException("SVG document is empty");
  
        Length  w = this.rootElement.width;
        Length  h = this.rootElement.height;
  
        // If width and height are both specified and are not percentages, aspect ratio is calculated from these (SVG1.1 sect 7.12)
        if (w != null && h != null && w.unit!=Unit.percent && h.unit!=Unit.percent)
        {
           if (w.isZero() || h.isZero())
              return -1f;
           return w.floatValue(this.renderDPI) / h.floatValue(this.renderDPI);
        }
  
        // Otherwise, get the ratio from the viewBox
        if (this.rootElement.viewBox != null && this.rootElement.viewBox.width != 0f && this.rootElement.viewBox.height != 0f) {
           return this.rootElement.viewBox.width / this.rootElement.viewBox.height;
        }
  
        // Could not determine aspect ratio
        return -1f;
     }
docs: Returns the aspect ratio of the document as a width/height fraction.
  <p>
  If the width or height of the document are listed with a physical unit such as "cm",
  then the current {@code renderDPI} setting will be used to convert that value to pixels.
  <p>
  If the width or height cannot be determined, -1 will be returned.
  
  @return the aspect ratio as a width/height fraction, or -1 if the ratio cannot be determined.
  @throws IllegalArgumentException if there is no current SVG document loaded.