Sha256: 8acdd22d758795e84806c877c8abf1fdf47a57313c9a68bb2031840a937bcbc4

Contents?: true

Size: 1010 Bytes

Versions: 1

Compression:

Stored size: 1010 Bytes

Contents

module WirisPlugin
include  Wiris
require('com/wiris/util/xml/WXmlUtils.rb')
require('com/wiris/plugin/api/ImageFormatController.rb')
  class ImageFormatControllerSvg
  extend ImageFormatControllerInterface

  include Wiris

    def initialize()
      super()
    end
    def getContentType()
      return "image/svg+xml"
    end
    def getMetrics(bytes,ref_output)
      svg = bytes::toString()
      output = ref_output
      svgXml = WXmlUtils::parseXML(svg)
      width = svgXml::firstElement()::get("width")
      height = svgXml::firstElement()::get("height")
      baseline = svgXml::firstElement()::get("wrs:baseline")
      if output!=nil
        PropertiesTools::setProperty(output,"width",""+width)
        PropertiesTools::setProperty(output,"height",""+height)
        PropertiesTools::setProperty(output,"baseline",""+baseline)
        r = ""
      else 
        r = (((("&cw="+width)+"&ch=")+height)+"&cb=")+baseline
      end
      return r
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wirispluginengine-3.62.0.1322 lib/com/wiris/plugin/impl/ImageFormatControllerSvg.rb