Load SVGZ Files in JavaFx2.0 and rasterize them

Hi!
I wanted to load via Java/JavaFx2.0 a .svgz file and rasterize it. Maybe someone got a clue?
Thanks for your answers in advance! My ideas up to now were to load them somehow with the batik lib via this code:
http://stackoverflow.com/questions/6854601/load-svg-file-in-javafx-2-0
... but I'm not sure.
Greetings!

Hi, it depends if you satisfied with having a SVG being transfered into an image and show this or if you want to have real JavaFX-node-objects. For the first one, there are some solutitons for the second one I have been fouling around with transfering it.
The code I put in here is experimental and in Scala (sorry, but I thing it is also read-able for Java dudes) and handles only a few SVG nodes. Batik is used to read it. It works (JavaFX 2.0 b42), but is definetly not very nice. Maybe that helps anyway :
package org.rob.svgtransform
import javafx.event.{Event, EventHandler}
import org.w3c.dom.{NamedNodeMap, NodeList, Document}
import javafx.scene.paint._
import javafx.scene.text.Text
import javafx.scene.image.{ImageView, Image}
import javafx.scene.shape._
import java.awt.image.RenderedImage
import org.apache.batik.ext.awt.image.codec.png.PNGDecodeParam
import org.apache.batik.ext.awt.image.codec.png.PNGImageDecoder
import javax.imageio.ImageIO
import org.apache.batik.ext.awt.image.codec.png.PNGImageEncoder
import org.apache.batik.ext.awt.image.codec.png.PNGEncodeParam
import collection.mutable.ListBuffer
import javafx.application.Application
import javafx.stage.Stage
import javafx.scene.{Scene, Node, Group}
import org.apache.batik.util.{XMLResourceDescriptor, ParsedURL}
import org.apache.batik.dom.svg._
import java.io._
trait FxEventHandler extends EventHandler[Event] {
  def setSvgToFx(sf : ISVGToFX)
trait ISVGToFX {
  def getRootNode : Group
  def getFxElementBySvgId(svgId : String) : Option[Node]
  def getSvgIdByFxElement(fxElement : Any) : Option[String]
  def getImageStrByImageId(imageId : String) : Option[String]
  def getSvgElementBySvgId(svgId : String) : Option[SVGOMElement]
class SVGToFX(svgDocument : Document) extends ISVGToFX {
  var eventHandler : FxEventHandler = null
  var fxElementToSvgIdMap = Map.empty[Any, String]
  var svgIdToFxElementMap = Map.empty[String, Any]
  var imageIdToImageStrMap = Map.empty[String, String]
  var svgIdToSvgElementMap = Map.empty[String, SVGOMElement]
  var eventHandlerNodes = Set.empty[Node]
  val rootElement = toFx(null, svgDocument)
  def setEventHandler(eventHandler : FxEventHandler) {
    this.eventHandler = eventHandler
    for(eventHandlerNode <- eventHandlerNodes)
      eventHandlerNode.setOnMouseClicked(eventHandler)
    eventHandler.setSvgToFx(this)
  def getSvgIdByFxElement(fxElement : Any) : Option[String] = fxElementToSvgIdMap.get(fxElement)
  def getFxElementBySvgId(svgId : String) : Option[Node] = svgIdToFxElementMap.get(svgId) match {
    case Some(el) => {
      if(el.isInstanceOf[Node])
        Option(el.asInstanceOf[Node])
      else
        None
    case None => None
  def getImageStrByImageId(imageId : String) : Option[String] = imageIdToImageStrMap.get(imageId)
  def getSvgElementBySvgId(svgId : String) : Option[SVGOMElement] = svgIdToSvgElementMap.get(svgId)
  def getRootNode : Group = rootElement.asInstanceOf[Group]
  protected def traverse(nl: NodeList, level: Int): Unit = {
    for (i <- 0 until nl.getLength)
      val n = nl.item(i)
      if(n.isInstanceOf[SVGOMElement]){
        val svgElem = n.asInstanceOf[SVGOMElement]
        val id = svgElem.getId
        val attr : NamedNodeMap = svgElem.getAttributes
        val range = 0.until(attr.getLength)
        val sp = space(level)
        println(sp + "-----------------------------")
        println(sp + "class = " + svgElem.getClass.getName)
        for(k <- range){
          val node = attr.item(k)
          println(sp + "name = " + node.getNodeName + "; value = " + node.getNodeValue)
        println(sp + "BPMNDItoSVG: ID = " + id)
        println(sp + "-----------------------------")
      traverse(n.getChildNodes, level + 1)
  protected def space(level : Int) : String = {
    var sb = new StringBuffer("")
    for(x <- 0 to level)
      sb = sb.append("   ")
    sb.toString
  var noIdCounter : Int = 0
  protected def toFx(parentId : String, obj : Any): Any = {
    def doGroup(svgId: String, nl: NodeList, g : Group){
      for (i <- 0 until nl.getLength){
        val el = toFx(svgId, nl.item(i))
        if(el != null){
          el match {
            //            case i : ImageView => refToImageMap = refToImageMap + (svgId -> i)
            case n : Node => {
              if(svgId != null && !"".equals(svgId ) && !fxElementToSvgIdMap.contains(n))
                fxElementToSvgIdMap = fxElementToSvgIdMap + (n -> svgId)
              g.getChildren.add(n)
    def getId(id : String) : String = {
      id match {
        case id : String => id
        case _ => {
          noIdCounter = noIdCounter + 1
          "noid_" + noIdCounter
    def getAttribute(attrs : NamedNodeMap, attr : String) : String = {
      val range = 0.until(attrs.getLength)
      for(k <- range){
        val node = attrs.item(k)
        if(attr.equals(node.getNodeName))
          return node.getNodeValue
        //println("name = " + node.getNodeName + "; value = " + node.getNodeValue)
      null
    var returnValue : Any = null
    val svgId : String = obj match {
      case e : SVGOMElement => {
        val svgEl = obj.asInstanceOf[SVGOMElement]
        getId(svgEl.getId)
      case _ => null
    obj match {
      case e : Document => {
        returnValue = new Group
        doGroup(svgId, e.getChildNodes, returnValue.asInstanceOf[Group])
        svgIdToFxElementMap = svgIdToFxElementMap + ("root" -> returnValue)
      case e : SVGOMDefsElement => {
        val nl = e.getChildNodes
        for (i <- 0 until nl.getLength)
          toFx(svgId, nl.item(i))  // ending up in fxElementMap because they only will be referenced and are not used directly
      case e : SVGOMLinearGradientElement => {
        val stopList = new java.util.ArrayList[Stop]()
        val nl = e.getChildNodes
        for (i <- 0 until nl.getLength){
          val el = toFx(svgId, nl.item(i))
          el match {
            case st : Stop => stopList.add(st)
            case _ =>
        val attr = e.getAttributes
        val startXStr = getAttribute(attr, "x1")
        val startYStr = getAttribute(attr, "y1")
        val stopXStr = getAttribute(attr, "x2")
        val stopYStr = getAttribute(attr, "y2")
        val startX = strToValue(startXStr).asInstanceOf[Double]
        val startY = strToValue(startYStr).asInstanceOf[Double]
        val stopX = strToValue(stopXStr).asInstanceOf[Double]
        val stopY = strToValue(stopYStr).asInstanceOf[Double]
        returnValue = new LinearGradient(startX,startY,stopX,stopY,false,CycleMethod.NO_CYCLE, stopList.asInstanceOf[java.util.List[Stop]])
        returnValue = new LinearGradient(0,0,0,1,true,CycleMethod.NO_CYCLE, stopList.asInstanceOf[java.util.List[Stop]])
      case e : SVGOMStopElement => {
        val attr = e.getAttributes
        val colorStr = getAttribute(attr, "style")
        val offsetStr = getAttribute(attr, "offset")
        val color = strToValue(colorStr).asInstanceOf[String]
        var offset = strToValue(offsetStr).asInstanceOf[Double]
        if(offset > 1.0)
          offset = 1.0
        returnValue = new Stop(offset, Color.web(color))
      case e : SVGOMImageElement => {
        val attr = e.getAttributes
        val imageDataStr = getAttribute(attr, "xlink:href")
        val widthStr = getAttribute(attr, "width")
        val heightStr = getAttribute(attr, "height")
        if(parentId != null)
          imageIdToImageStrMap = imageIdToImageStrMap + (parentId -> imageDataStr)
      case e : SVGOMEllipseElement => {
        val attr = e.getAttributes
        val transformStr = getAttribute(attr, "transform")
        val fillStr = getAttribute(attr, "fill")
        val rxStr = getAttribute(attr, "rx")
        val cxStr = getAttribute(attr, "cx")
        val ryStr = getAttribute(attr, "ry")
        val cyStr = getAttribute(attr, "cy")
        val strokeStr = getAttribute(attr, "stroke")
        val strokeWidthStr = getAttribute(attr, "stroke-width")
        val rx = strToValue(rxStr).asInstanceOf[Double]
        val cx = strToValue(cxStr).asInstanceOf[Double]
        val ry = strToValue(ryStr).asInstanceOf[Double]
        val cy = strToValue(cyStr).asInstanceOf[Double]
        val ellipse = new Ellipse(cx, cy, rx, ry)
        getFill(fillStr) match {
          case p : Paint => ellipse.setFill(p)
          case _ =>
        setTransforms(ellipse, transformStr)
        if(eventHandler != null)
          ellipse.setOnMouseClicked(eventHandler)
        returnValue = ellipse
      case e : SVGOMTextElement => {
        val attr = e.getAttributes
        val xStr = getAttribute(attr, "x")
        val fontSizeStr = getAttribute(attr, "font-size")
        val yStr = getAttribute(attr, "y")
        val fillStr = getAttribute(attr, "fill")
        val textAnchorStr = getAttribute(attr, "text-anchor")
        val fontDecorationStr = getAttribute(attr, "font-decoration")
        val fontFamilyStr = getAttribute(attr, "font-family")
        val fontWeightStr = getAttribute(attr, "font-weight")
        val x = strToValue(xStr).asInstanceOf[Double]
        val y = strToValue(yStr).asInstanceOf[Double]
        val t = new Text(x, y, e.getTextContent)
        //        val t = new Text(x - 30, y, e.getTextContent)
        //        t.setTextAlignment(TextAlignment.LEFT)
        eventHandlerNodes = eventHandlerNodes + t
        returnValue = t
      case e : SVGOMRectElement => {
        val attr = e.getAttributes
        val xStr = getAttribute(attr, "x")
        val yStr = getAttribute(attr, "y")
        val transformStr = getAttribute(attr, "transform")
        val fillStr = getAttribute(attr, "fill")
        val widthStr = getAttribute(attr, "width")
        val rxStr = getAttribute(attr, "rx")
        val ryStr = getAttribute(attr, "ry")
        val heightStr = getAttribute(attr, "height")
        val strokeStr = getAttribute(attr, "stroke")
        val strokeWidthStr = getAttribute(attr, "stroke-width")
        val x = strToValue(xStr).asInstanceOf[Double]
        val y = strToValue(yStr).asInstanceOf[Double]
        val rx = strToValue(rxStr).asInstanceOf[Double]
        val ry = strToValue(ryStr).asInstanceOf[Double]
        val strokeWidth = strToValue(strokeWidthStr).asInstanceOf[Double]
        val width = strToValue(widthStr).asInstanceOf[Double]
        val height = strToValue(heightStr).asInstanceOf[Double]
        val rect = new Rectangle(x, y, width, height)
        rect.setArcHeight(ry)
        rect.setArcWidth(rx)
        rect.setStroke(Color.GRAY)
        rect.setStrokeWidth(strokeWidth)
        getFill(fillStr) match {
          case p : Paint => rect.setFill(p)
          case _ =>
        setTransforms(rect, transformStr)
        eventHandlerNodes = eventHandlerNodes + rect
        returnValue = rect
      case e : SVGOMUseElement => {
        val attr = e.getAttributes
        val xStr = getAttribute(attr, "x")
        val yStr = getAttribute(attr, "y")
        val widthStr = getAttribute(attr, "width")
        val heightStr = getAttribute(attr, "height")
        val xlinkHrefStr = getAttribute(attr, "xlink:href")
        val x = strToValue(xStr).asInstanceOf[Double]
        val y = strToValue(yStr).asInstanceOf[Double]
        val width = strToValue(widthStr).asInstanceOf[Double]
        val height = strToValue(heightStr).asInstanceOf[Double]
        val xlinkHref = strToValue(xlinkHrefStr).asInstanceOf[String]
        returnValue = imageIdToImageStrMap.get(xlinkHref) match {
          case Some(imageDataStr) => {
            val i : Image = strToValue(imageDataStr).asInstanceOf[Image]
            val iv2 = new ImageView
            iv2.setImage(i)
            //            iv2.setFitWidth(100);
            //            iv2.setPreserveRatio(true)
            //            iv2.setSmooth(true)
            //            iv2.setCache(true)
            iv2.setX(x)
            iv2.setY(y)
            iv2.setFitHeight(height)
            iv2.setFitWidth(width)
            iv2
          case None => null
      case e : SVGOMPathElement => {
        val attr = e.getAttributes
        val fillStr = getAttribute(attr, "fill")
        val strokeWidthStr = getAttribute(attr, "stroke-width")
        val pathStr = getAttribute(attr, "d")
        val transformStr = getAttribute(attr, "transform")
        val strokeStr = getAttribute(attr, "stroke")
        val strokeWidth = strToValue(strokeWidthStr).asInstanceOf[Double]
        val svgPath = new SVGPath
        getFill(fillStr) match {
          case p : Paint => svgPath.setFill(p)
          case _ =>
        svgPath.setStrokeWidth(strokeWidth)
        svgPath.setContent(pathStr)
        svgPath.setStroke(Color.BLACK)
        setTransforms(svgPath, transformStr)
        eventHandlerNodes = eventHandlerNodes + svgPath
        returnValue = svgPath
      case e : SVGOMPolylineElement => {
        val attr = e.getAttributes
        val fillStr = getAttribute(attr, "fill")
        val strokeWidthStr = getAttribute(attr, "stroke-width")
        val pointsStr = getAttribute(attr, "points")
        val strokeStr = getAttribute(attr, "stroke")
        val transformStr = getAttribute(attr, "transform")
        val points = strToValue("points:" + pointsStr).asInstanceOf[Array[Double]]
        //        val points = Array[Double](676.0,672.0,676.0,630.0)
        val strokeWidth = strToValue(strokeWidthStr).asInstanceOf[Double]
        val polyline = new Polyline(points)
        getFill(fillStr) match {
          case p : Paint => polyline.setFill(p)
          case _ =>
        polyline.setStrokeWidth(strokeWidth)
        polyline.setStroke(Color.BLACK)
        setTransforms(polyline, transformStr)
        eventHandlerNodes = eventHandlerNodes + polyline
        returnValue = polyline
      case e : SVGOMCircleElement => {
        val attr = e.getAttributes
        val fillStr = getAttribute(attr, "fill")
        val strokeWidthStr = getAttribute(attr, "stroke-width")
        val strokeStr = getAttribute(attr, "stroke")
        val rStr = getAttribute(attr, "r")
        val cxStr = getAttribute(attr, "cx")
        val cyStr = getAttribute(attr, "cy")
        val transformStr = getAttribute(attr, "transform")
        val circle = new Circle
        getFill(fillStr) match {
          case p : Paint => circle.setFill(p)
          case _ =>
        val strokeWidth = strToValue(strokeWidthStr).asInstanceOf[Double]
        val r = strToValue(rStr).asInstanceOf[Double]
        val cx = strToValue(cxStr).asInstanceOf[Double]
        val cy = strToValue(cyStr).asInstanceOf[Double]
        circle.setStrokeWidth(strokeWidth)
        circle.setCenterX(cx);
        circle.setCenterY(cy);
        circle.setRadius(r);
        circle.setStroke(Color.BLACK)
        setTransforms(circle, transformStr)
        eventHandlerNodes = eventHandlerNodes + circle
        returnValue = circle
      case e : SVGOMSVGElement => {
        val attr = e.getAttributes
        val transformStr = getAttribute(attr, "transform")
        val g = new Group
        doGroup(svgId, e.getChildNodes, g)
        setTransforms(g, transformStr)
        returnValue = g
      case e : SVGOMGElement => {
        val attr = e.getAttributes
        val transformStr = getAttribute(attr, "transform")
        val g = new Group
        doGroup(svgId, e.getChildNodes, g)
        setTransforms(g, transformStr)
        returnValue = g
      case e => { println("Element " + e + " is not supported yet!")
    if(returnValue != null && svgId != null && !svgId.equals("")){
      fxElementToSvgIdMap = fxElementToSvgIdMap + (returnValue -> svgId)
      svgIdToFxElementMap = svgIdToFxElementMap + (svgId -> returnValue)
      if(obj != null && obj.isInstanceOf[SVGOMElement])
        svgIdToSvgElementMap = svgIdToSvgElementMap + (svgId -> obj.asInstanceOf[SVGOMElement])
    returnValue
  def setTransforms(node : Node, transformStr : String) {
    var translate : Array[Double] = null
    var rotate : Array[Double] = null
    if(transformStr != null){
      val translateIdx = transformStr.indexOf("translate(")
      val rotateIdx = transformStr.indexOf("rotate(")
      if(translateIdx >= 0){
        val translateEndIdx = transformStr.indexOf(")", translateIdx)
        val translateStr = transformStr.substring(translateIdx + 10, translateEndIdx)
        translate = listToDoubleArray(translateStr)
      if(rotateIdx >= 0){
        val rotateEndIdx = transformStr.indexOf(")", rotateIdx)
        val rotateStr = transformStr.substring(rotateIdx + 7, rotateEndIdx)
        rotate = listToDoubleArray(rotateStr)
    if(translate != null){
      node.setTranslateX(translate(0))
      node.setTranslateY(translate(1))
    if(rotate != null){
      node.setRotate(rotate(0))
      //      node.setRotationAxis(new Point3D(rotate(1), rotate(2), 0.0))
  def getFill(str : String) : Paint = {
    if(str != null){
      str.startsWith("url(#") match {
        case true => {
          val fillLink = strToValue(str).asInstanceOf[String]
          val fill = svgIdToFxElementMap.get(fillLink) match {
            case Some(element) => element match {
              case lg : LinearGradient => lg
              case _ => Color.GREEN
            case None => Color.BLUE
          fill
        case false => str.startsWith("none") match {
          case false => Color.web(str, 1.0)
          case true =>  Color.WHITE  // ToDo: make sure this is the background color
    } else
      Color.RED
  def strToValue(str : String) : Any = {
    var returnValue : Any = null
    if(str != null){
      if(str.endsWith("%")){
        val s = str.substring(0, str.length() - 1)
        returnValue = s.toDouble
      } else if(str.startsWith("data:image")){
        val pu = new ParsedURL(str)
        val pust = pu.openStream()
        var awti : RenderedImage = null
        if(str.contains("png")){
          val pngdp = new PNGDecodeParam
          val pngde = new PNGImageDecoder(pust, pngdp)
          awti = pngde.decodeAsRenderedImage()
        } else if(str.contains("gif")){
          val is = new BufferedInputStream(pust);
          awti = ImageIO.read(is);
        if(awti != null){
          val baos = new ByteArrayOutputStream
          val pngen = new PNGImageEncoder(baos, new PNGEncodeParam.Palette)
          pngen.encode(awti)
          val bais = new ByteArrayInputStream(baos.toByteArray)
          returnValue = new Image(bais)
        } else
          returnValue = null
      } else if(str.startsWith("points:")){
        returnValue = listToDoubleArray(str.substring(7))
      } else if(str.startsWith("#")){
        returnValue = str.substring(1)
      } else if(str.startsWith("url(#")){
        val endIdx = str.indexOf(")")
        returnValue = str.substring(5,endIdx)
      } else if(str.startsWith("stop-color:")){
        returnValue = str.substring(11)
      } else {
        returnValue = str.toDouble
    returnValue
  def listToDoubleArray(listStr : String) : Array[Double] = {
    val seperators = Array[Char](' ', ',', ')')
    val ps = listStr.split(seperators)
    val lb = new ListBuffer[Double]()
    for(v <- ps)
      lb +=  strToValue(v).asInstanceOf[Double]
    lb.toArray
trait SVGElement{
  val svgId : String
object SVGToFXTest {
  def main(args : Array[String]){
    Application.launch(classOf[SVGToFXTest], args)
class SVGToFXTest extends Application {
  def start(st : Stage) {
    st.setWidth(1000)
    st.setHeight(800)
    st.setTitle("SVGToFX");
    st.setResizable(true);
    val root = new Group
    val scene = new Scene(root)
    st.setScene(scene)
    val fr = new FileReader("D:\\Development\\Playground\\SvgTransform\\data\\Test2.svg")
    val parser: String = XMLResourceDescriptor.getXMLParserClassName
    val fa: SAXSVGDocumentFactory = new SAXSVGDocumentFactory(parser)
    val doc = fa.createDocument(SVGDOMImplementation.SVG_NAMESPACE_URI, fr).asInstanceOf[SVGOMDocument]
    val svgToFx = new SVGToFX(doc)
    root.getChildren.add(svgToFx.getRootNode)
    println("Test")
    st.setVisible(true)
}Edited by: user6782617 on 07.10.2011 04:56

Similar Messages

  • How to load PDF files into oracle database and display them in APEX

    Hi All,
    We have a requirement for loading the Loading PDF files (lots of PDf files) to the oracle database and then display the PDF files in the Oracel APEX report.
    So that User can view the PDF files. Our current APEX verison is 3.2..
    Please let me know how to implement it and where to find the sample application!
    Thanks in advanced!
    Jane

    Thanks Tony for your quick response!
    We need to load a lot of PDfs (history + current).
    I have a questions about the SQL loader. I am trying to insert a pdf file into a table by following the oracle loading sample:
    http://download.oracle.com/docs/cd/B10501_01/text.920/a96518/aload.htm
    Example Data File: loader2.dat
    This file contains the data to be loaded into each row of the table, articles_formatted.
    Each line contains a comma separated list of the fields to be loaded in articles_formatted. The last field of every line names the file to be loaded in to the text column:
    Ben Kanobi, plaintext,Kawasaki news article,../sample_docs/kawasaki.txt,
    But i don't know to where should I put my pdf file on the server.
    for example:
    ,../sample_docs/kawasaki.txt,
    Where is the file 'kawasaki.txt'??
    I try my local path, it didn't work. like c:\temp.
    then I loaded teh PDf file into our server(/findev20/olmtest/orafin/11.5.7/olmtestcomn/temp) , and In my data file. I put the path
    1, pdf_emp1,../findev20/olmtest/orafin/11.5.7/olmtestcomn/temp
    but I got the error: the system can not find the file specified.
    Where should I put the PDf files on the server and how to specify the path in the data file?
    Thanks!
    Jane

  • Hi, i purchased a 2 dvd digital set. i cant just download it straight to my ipad. they said i have to down load it to my i tunes, then can transfer to i pad. im not seeing how to click the files from my email, and get them into the i tunes acct... ugh.

    hi, i purchased a 2 dvd digital set. i cant just download it straight to my ipad. they said i have to down load it to my i tunes, then can transfer to i pad. im not seeing how to click the files from my email, and get them into the i tunes acct... ugh.
    i do not have a mac home pc. just a regular pc

    I had the same problem after I gave my old iPad to my parents and tried to install Netflix. This is what you have to do:  Open iTunes on your computer, the one you sync your iPad to. Then go to iTunes Store and search for and download Netflix app. After you download it, if your iPad is set to download new purchases it may start downloading on your iPad. If so, tap and hold to delete the app (because it is trying to install the new version on the iPad) Next step, go to the App Store on your iPad and find Netflix and it should say install since you already purchased it on the computer. Tap to install, and it will say the version is not compatible, tap to download a previous version. Click that and it will install the older version!    One more thing, if and when you sync to your computer again it will say something like " Unable to install Netflix on your iPad" Just click the box to never remind you again, because it's trying to sync the newer Netflix app to your iPad, but it doesn't work so it displays the message. The old app will remain on the ipad. Hope this helps, good luck

  • Trying to down load a file that contains .exe and .bin files on Unity(gaming builder)

    Trying to down load a file that contains .exe and .bin files on Unity(gaming builder). can this be done on iMac. it is a video game? It works fine in windows computer? dont know if this limited information helps. Is there a program or something i need to buy or download? Thanks

    Hello,
    .exe files are Windows® executable files, so you'd need Windows Installed.

  • I have photoshop CC. I cannot open two files such as Tiffs and view them side by side. When I open the second file it overrides the first. Do I need to do something with preferences?

    I have photoshop CC. I cannot open two files such as Tiffs and view them side by side. When I open the second file it overrides the first. Do I need to do something with preferences?

    What happens when you try to use the clone stamp tool?
    It should work with the images side by side.
    You can setup photoshop cc to be like photoshop cs2 was on your other mac, by going to Photoshop>Preferences>Interface and unchecking
    Open Documents as Tabs and Enable Floating Document Window Docking
    And also going to Window and unchecking Application Frame

  • Infopackage-Load Many Files from Application Server and later Archive/Move

    Hi All..
      I have a doubt,   I have a requirement of take many files to load into BI 7.0..  I used the infopackage before with option:
    Load Binary File From Application server
      I load information successfully... only with one file ...but If I can load many files (with different names) like the next list.. I think it's not a good idea modify the file name (path) on infopackage each time).. :
    *All of this files will be on one server that itu2019s map into AL11.. Like
    Infopfw
    BW_LOAD_20090120.txt
    BW_LOAD_20090125.txt
    BW_LOAD_OTHER_1.txt
    u2026.
    Etc..
    This directory it's not in BW server.. It's other server..but I can load form this location (one file by one)
    Could you help me with this questions:
    -     How can I Use an infopackage with routine that take all the files..one by oneu2026 in order of creation dateu2026and load into Target? Is it possible?.. I have some knowledge of ABAP.. but I don´t know exactly how I can say to system this logicu2026
    -     In addition is it possible move this files to other locationu2026 like into Infopfwarchive u2026 just to have an history of files loaded.
    I saw that in infopackage you have an option to create a routine.. in ABAP codeu2026 Iu2019m a little bit confused because I donu2019t  know how I can specify all the path..
    I try with:
    Infopfw
    InfopfwFile.csv
    Infopfw
    This is the abap code that automatically you see and you need to modifyu2026
    Create a routine for file name
    This routine will be called by the adapter,
    when the infopackage is executed.
              p_filename =
              p_subrc = 0.
    Thank you for your ideas or recommendations.
    Al

    Hi Reddy, thank you for your answer
    I have some doubuts.. when you explain me the option:
    All the above files are appending dates at the end of the file....
    You can load the files through infopackage by using Routines and pick the files based on date at the end of the file..***
    I need to ask you if you think that when you know the date of the file and the infopackage pick each file... thi can work for many files??... or how it's possible control this process?
    About this option, I want to ask you If when you menction Unix code... where it's programed this code?.. in the routine of BW Infopackage??
    ****Or
    Create two folders in your BW in Application server level, in AL11 (ask Basis team)
    I call it is F1 and F2 folders.
    First dump the files into F1 I assume that the file name in F1 is "BW_LOAD_20090120.txt", using Unix code you rename the file and then keep in the same foleder F1 or move to F2.
    Then create InfoPackage and fix the file name (i.e. you renamed), so you don't need to change everyday your file name at infopackage level.Because in AL11 everyday the file are overwrite.
    To I get BW_LOAD_20090120.txt file in F1, then I renamed to BW_LOAD.txt and loaded into BW, then tomorrow I get BW_LOAD_20090125.txt in F1, then I renamed to BW_LOAD.txt....
    so in this way it will work.You need to schedule the Ubix script in AL11.
    This is the way how to handle the application server...I'm using the same logic.
    Thank you soo much.
    Al

  • How can load properties file for one time and use in entire application

    Hi folks,
    I dont want to read properties file every time , and want to get property value in any servelet or jsp page.(means i want to read only property file only for once and want to get value in any where ) , how to do this.
    Message was edited by:
    RajeshwarReddyT

    means we have to read file every time Know but i dont
    want to be happen that ??? No you don't . You read the file once. You store it in the hashmap. Then you hand that hashmap to whatever class needing the data.
    getProperties() returns the hashmap, doesn't read the file.
    Maybe I should have called the method getMap or something.
    Message was edited by:
    karma-9

  • Loading property files from a class and not a servlet...

    Hi, I was wondering if anyone has a good solution for loading property files from a class instead of a servlet. I would like to load the property file similarly to how it is done from HttpServlet.
    Here is the large picture. I have a tag library that calls a class which needs to access a database. The class needs to know what DB to access so it needs to look at some property file. The problem is that I don't want to hardcode the properties or the path of where the property file exists. I hope this all makes sense.
    Thanks.
    -PV

    I use the getResource method in the java.lang.Class class. Read about this method in the api.
    Anyways this is roughly how it's : you must put your properties file in the classpath. Then in your class :
    Properties prop = new Properties();
    URL url = this.getClass().getResource("/config/db.properties");
    prop.load(url.openStream());In this case, you must put the "config" (where you've written your db.properties file) directory's parent in the classpath.

  • Can a script be written to take the next 2 files in a folder and place them on a background image..then saving with the first images filename..?

    Hello all, I hope you can help.
    In Photoshop I have a problem to overcome and have delved into the world of scripting..
    If there is a quick way to produce the following could someone help me with some pointers?
    Here is my situation..
    I need to produce a photograph proof card, these are for a double image option so cause me a headache compared to just creating an action..
    This proof card really is just a set of two different photographs placed onto a background image.
    I would produce two different images of the same person and name them exactly the same except they are suffixed with an A or B to keep them together, these would be in a folder with approx 500 other images for example (250 x two of each person)
    My preference for the process would be done in the following sequence:
    1/ Open the background file jpg (which is sized at 2400 x 1800 pixels @ 300dpi)
    2/ Load the first image from the batch file and place this.
    3/ Get the filename of the first image and create it as a text layer and write it below the image at 10 point text size.
    4/ Create another copy of this layer and change the font to 3of9barcode font, however the font needs an asterisk before the text then again after it. e.g. *filenameA*
         Only the first image has the need for a barcode as they are for the same person. This is at 18 point.
    5/ Load the next sequential image from the batch file and place this.
    6/ Get the filename for the second image and as Item 3/ create a text layer below at 10 point text size.
    7/ Place a png overlay with my copyright information over the images (I need to do this twice, once for each image)
    8/ Flatten the images and save the file in a new folder with the same filename as the first image.
    I can do this in Lightroom with the exception of putting the barcoded text, and the filenaming, this is because the background image is used as the identity plate and the filename is not based on the data from either photograph..
    Can anyone shed some light on where to go from here?
    Kind regards
    Bryan

    Photoshop Scripting-wise this seems fairly "easy".
    But I would recommend creating a template file (that already combines background image, png overlay and the Type Layers).
    Maybe data driven graphics would also be an option …
    Photoshop Help | Creating data-driven graphics

  • Loading multiple swf's in runtime and playing them one after other

    Hi,
    I am looking for help in loading multiple swf's as a playlist and playing them one after other on top of the other, so here even we have to play with display list for the visiblity.
    Tried to load single files but not getting for multiple files, what will be the event with which the dynamically loaded swf switch to other.These file names will be mentioned in XML file.
    Please let me know your thoughts and will be greatfull if anybody can help with the script or any kind of tutorials.

    Hi,
    First of all am thanking you for showing your kind intrest towards this thread, and appreciate for spending time to work out this issue.
    I will explain you in deatil the issue what am facing,I am working on a project where basically dealing with flv player and videos, am trying to play multiple flv videos of a 3d human character who is speaking out a number like 3550.
    Here we are using multiple video files and joining them like videos where character says 3 then 1000 then  5 then 50.
    The issue here is after every video there is a fraction of second where the character is disappearing from the stage which we can't afford because all the numbers have to be played at once to show it as one single digit.
    So thought of trying swf's instead of flv so that we can omit the gap between the numbers, but even in this swf's also having same issue for a fraction of second the character is missing from the stage.
    I am looking for a solution to this, either the way can work out as flv or swf.For flv am trying to edit some player where we can remove the delay between the clips.
    I am attaching new swf where the character is speaking 3 numbers like 3,1000,40.You can notice there is a flicker between the swf's.
    Can we use Display list with which we can omit that gap.
    Looking for your thoughts and help.
    Thank you

  • How do you take MANY slices of an audio file on garage band and merge them together without dragging and dropping each one?

    I record my classroom lectures in law school to help study for finals. However in the hour and a half class there are many pauses, bad questions, wrong answers, useless stories or announcements that I do not have to hear again. I import the audio into gargae band and cut out all the unnessesary stuff. I end up with a file of 100 + clips. If i spend the time dragging and droping them so there are no spaces in between clips the process takes forever. However the reward is relistenign to an hour and half lecture in 15-20 minutes. Thats about how much content the professor gives. Is there a way to merge all the audio by selecting some option? I bascially want garage band to just slide all the clips and condence it to one clip.
    I have takent the time the last few semesters to do this the hard way and have been able to relisten to an entire class in 3.5 hours which is huge! if you have ever been in law school. But I don't have that kind of time anymore. HELP!

    petruch wrote:
    Is there a way to merge all the audio by selecting some option?
    http://www.bulletsandbones.com/GB/GBFAQ.html#cutsectionnospace
    (Let the page FULLY load. The link to your answer is at the top of your screen)

  • Adding .class files to your project and making them work.

    Ok, im fairly new to java and having trouble understanding how to make importing of .class files work. Im using eclipse 3.2
    I have the files in a directory and I have gone to project->properties->java build path->libraries->add external class folder and pointed it to the correct place.
    Now, I am trying to use some of the classes it provides. I get no errors when creating the object with this code:
    com.ECS.client.jax.ItemSearchRequest itemRequest = new com.ECS.client.jax.ItemSearchRequest();
    Before I did the add external class folder that code would error cause it didnt know what com.ECS was. Now it works fine. My problem is that when I try to use a class, it does not recognize it as a class. After doing the above code I have:
    itemRequest.setSearchIndex("Books");
    its giving me an error on the period, saying: "Syntax error on token(s), misplaced construct(s)". Its not seeing that it is a class, so I can't use it. But when I am creating the object I get no errors. For reference, here is the chunk of code:
    com.ECS.client.jax.ItemSearchRequest itemRequest = new com.ECS.client.jax.ItemSearchRequest();
    itemRequest.setSearchIndex("Books");
    the second line of which errors. So my question is, how do I get it to recognize that the itemRequest is a class when I have imported the .class files to my project already?

    It's working fine. It's just that you have to put your code in a method.

  • Large XML files, how to split and read them in PI

    Hi,
    For a specific requirement, we have a 60 MB-90 MB XML file being generated by a legacy application.
    This file has to be processed by PI 7.31 Sender File Adapter and should be posted as a ABAP proxy to SAP ECC system.
    To address any performance issues, we are planning to read the files in chunks.
    Is there a way by which we can configure the file adapter to pick a fixed no.of records to limit the size.
    In inputs in this regard will be appreciated.
    regards,
    Younus

    Hi Younus,
    First of all if you are using PI 7.31, then you should be quite able to process XML file of about 100MB scale. Performance issue shall occur in ECC side instead as it can not handle such high volume.
    My suggestion will be to pick the whole XML file at one go and do necessary mapping. However on receiver side use SOAP Adapter instead of XI for making proxy calls to ECC.
    In SOAP adapter (using HTTP as Transport and XI 3.0 as Message protocol) there's an option as 'XI Packaging' which can be used to send data in packets.
    Refer below help doc on it.
    Configuring the Receiver SOAP Adapter - Advanced Adapter Engine - SAP Library
    Thanks
    Bibek

  • Loading many fxmls at a stretch and using them wen necessary

    HI,
    Any suggestions on loading many fxmls at a stretch and can be used wen it is necessary.
    Like, i have many fxml's in my application, each fxml is taking time wen loading.so it is like a performance issue.
    and how can i minimize the use of controllers?
    and also plz suggest me, fxml(parent) having fxml (child).

    HI,
    Any suggestions on loading many fxmls at a stretch and can be used wen it is necessary.
    Like, i have many fxml's in my application, each fxml is taking time wen loading.so it is like a performance issue.
    and how can i minimize the use of controllers?
    and also plz suggest me, fxml(parent) having fxml (child).

  • Download files from the URL and store them in the table

    Hello,
    I want to download files from the URL and want to store them in the table.
    Can I do it using sql/pl-sql.
    Please help me on this.
    Thanks,
    Rajendra Yadav

    Never tried it before...
    Is this what you are talking about?
    http://www.oracle-base.com/articles/10g/file-upload-download-procedures-10g.php
    Cheers,
    Manik.

Maybe you are looking for