Package org.openmeetings.app.batik.beans

Examples of org.openmeetings.app.batik.beans.PrintBean


      log.debug("user_level: "+user_level);
     
      if (user_level!=null && user_level > 0 && hash != "") {
       
       
        PrintBean pBean = PrintService.getPrintItemByHash(hash);
       
        //Whiteboard Objects
        List whiteBoardMap = pBean.getMap();
       
        // Get a DOMImplementation.
            DOMImplementation domImpl =
                GenericDOMImplementation.getDOMImplementation();

            // Create an instance of org.w3c.dom.Document.
            //String svgNS = "http://www.w3.org/2000/svg";
            String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI;

            Document document = domImpl.createDocument(svgNS, "svg", null);
           
            // Get the root element (the 'svg' element).
            Element svgRoot = document.getDocumentElement();

           
            // Set the width and height attributes on the root 'svg' element.
            svgRoot.setAttributeNS(null, "width", ""+pBean.getWidth());
            svgRoot.setAttributeNS(null, "height", ""+pBean.getHeight());
           
            log.debug("pBean.getWidth(),pBean.getHeight()"+pBean.getWidth()+","+pBean.getHeight());
           

            // Create an instance of the SVG Generator.
            SVGGraphics2D svgGenerator = new SVGGraphics2D(document);
           
            svgGenerator = WhiteboardMapToSVG.getInstance().convertMapToSVG(svgGenerator, whiteBoardMap);
           
            // Finally, stream out SVG to the standard output using
            // UTF-8 encoding.
            boolean useCSS = true; // we want to use CSS style attributes
            //Writer out = new OutputStreamWriter(System.out, "UTF-8");
           
           
            String requestedFile = fileName+"_"+CalendarPatterns.getTimeForStreamId(new Date())+".svg";
           
            if (exportType.equals("svg")) {
              //OutputStream out = httpServletResponse.getOutputStream();
          //httpServletResponse.setContentType("APPLICATION/OCTET-STREAM");
          //httpServletResponse.setHeader("Content-Disposition","attachment; filename=\"" + requestedFile + "\"");
              Writer out = httpServletResponse.getWriter();
             
              svgGenerator.stream(out, useCSS);
             
             
            } else if (exportType.equals("png") || exportType.equals("jpg")
                || exportType.equals("gif") || exportType.equals("tif")
                || exportType.equals("pdf")){
             
              String current_dir = getServletContext().getRealPath("/");
              String working_dir = current_dir + "uploadtemp" + File.separatorChar;
             
              String requestedFileSVG = fileName+"_"+CalendarPatterns.getTimeForStreamId(new Date())+".svg";
              String resultFileName = fileName+"_"+CalendarPatterns.getTimeForStreamId(new Date())+"."+exportType;
             
              log.debug("current_dir: "+current_dir);
              log.debug("working_dir: "+working_dir);
              log.debug("requestedFileSVG: "+requestedFileSVG);
              log.debug("resultFileName: "+resultFileName);
             
              File svgFile = new File(working_dir + requestedFileSVG);
              File resultFile = new File(working_dir + resultFileName);
             
              log.debug("svgFile: "+svgFile.getAbsolutePath());
              log.debug("resultFile: "+resultFile.getAbsolutePath());
              log.debug("svgFile P: "+svgFile.getPath());
              log.debug("resultFile P: "+resultFile.getPath());
             
              FileWriter out = new FileWriter(svgFile);
              svgGenerator.stream(out, useCSS);
             
              HashMap<String,Object> returnError = GenerateImage.getInstance().convertImageByTypeAndSize(
                  svgFile.getAbsolutePath(), resultFile.getAbsolutePath(),
                  pBean.getWidth(), pBean.getHeight());
             
              //Get file and handle download
          RandomAccessFile rf = new RandomAccessFile(resultFile.getAbsoluteFile(), "r");

          httpServletResponse.reset();
View Full Code Here


      }
      return null;
  }
 
  public static synchronized PrintBean getPrintItemByHash(String hash) throws Exception {
    PrintBean itemList = currentExportList.get(hash);
//    if (itemList != null) {
//      currentExportList.remove(hash);
//    }
    return itemList;
  }
View Full Code Here

//    }
    return itemList;
  }
 
  public static synchronized void addPrintItembyMap(String hash, List map, int width, int height) throws Exception {
    PrintBean pBean = new PrintBean(hash, map, width, height);
    currentExportList.put(hash, pBean);
  }
View Full Code Here

      }
      return null;
  }
 
  public static synchronized PrintBean getPrintItemByHash(String hash) throws Exception {
    PrintBean itemList = currentExportList.get(hash);
//    if (itemList != null) {
//      currentExportList.remove(hash);
//    }
    return itemList;
  }
View Full Code Here

//    }
    return itemList;
  }
 
  public static synchronized void addPrintItembyMap(String hash, @SuppressWarnings("rawtypes") List map, int width, int height) throws Exception {
    PrintBean pBean = new PrintBean(hash, map, width, height);
    currentExportList.put(hash, pBean);
  }
View Full Code Here

      log.debug("users_id: " + users_id);
      log.debug("user_level: " + user_level);

      if (user_level != null && user_level > 0 && hash != "") {

        PrintBean pBean = PrintService.getPrintItemByHash(hash);

        // Whiteboard Objects
        @SuppressWarnings("rawtypes")
        List whiteBoardMap = pBean.getMap();

        // Get a DOMImplementation.
        DOMImplementation domImpl = GenericDOMImplementation
            .getDOMImplementation();

        // Create an instance of org.w3c.dom.Document.
        // String svgNS = "http://www.w3.org/2000/svg";
        String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI;

        Document document = domImpl.createDocument(svgNS, "svg", null);

        // Get the root element (the 'svg' element).
        Element svgRoot = document.getDocumentElement();

        // Set the width and height attributes on the root 'svg'
        // element.
        svgRoot.setAttributeNS(null, "width", "" + pBean.getWidth());
        svgRoot.setAttributeNS(null, "height", "" + pBean.getHeight());

        log.debug("pBean.getWidth(),pBean.getHeight()"
            + pBean.getWidth() + "," + pBean.getHeight());

        // Create an instance of the SVG Generator.
        SVGGraphics2D svgGenerator = new SVGGraphics2D(document);

        svgGenerator = WhiteboardMapToSVG.getInstance()
View Full Code Here

TOP

Related Classes of org.openmeetings.app.batik.beans.PrintBean

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.