Uploaded image for project: 'Openmeetings'
  1. Openmeetings
  2. OPENMEETINGS-247

Make document conversion quality an administrator changeable option

    XMLWordPrintableJSON

Details

    Description

      I have the need to improve the quality of converted PDF, Word or PowerPoint files, that is increase the resolution of the conversion process for Word PDF and PowerPoint files are converted to *.swf files.

      Currently the quality of any images within converted documents is so poor that we cannot clearly read the text within the images contained in documents.

      This may be able to be resolved by allowing the quality of file conversion to be adjustable in the administration section of OpenMeeting or in the config.xml file.

      Checking the OpenMeetings log it would seem that it is using pdf2swf without any "-j" setting, I found this in the log file;
      args: [/usr/local/bin/pdf2swf, -s, insertstop, -s, poly2bitmap, -I, /user/lib/red5/webapps/openmeetings/upload/files/le8...

      Checking some of the source code I noticed that in the code these does not appear that the "-j" option is being used, therefore I guess the default value of 85% is being used when converting documents.

      -j , --jpegquality quality Set quality of embedded jpeg pictures to quality. 0 is worst (small), 100 is best (big). (default:85)
      zoom=<dpi> the resultion (default: 72)

      I could not find any settings in the /usr/lib/red5/webapps/openmeetings/config.xml file for the pdf2swf arguments.

      And I don't think that I can change this in OpenMeetings, it is most likely set somewhere in the source code?

      Sadly I have never managed to successfully build OpenMeetings using "ant", but checking the source code, maybe the place to add the "-j" option may be in;
      ./openmeetings/trunk/singlewebapp/src/org/openmeetings/app/documents/GenerateSWF.java line 216
      // Create the Content of the Converter Script (.bat or .sh file)

      I wonder if the developers would be able to add the "-j" option and a "-s zoom=xxx" option as a user setting, and allow this value to be adjustable by administrators?

      For example, I made the following changes so I could test the JpegQuality and zoom options;

      /singlewebapp/src/install_step1_EN.vm
      ./src/.svn/text-base/install_step1_EN.vm.svn-base

      <fieldset id="userConf1">
      <legend>Converters</legend>
      <li>
      <label for="swftools_path">SWFTools Path</label>
      <input name="swftools_path" id="swftools_path" size="27"
      title="Enter the path to swftools for example C:/swftools (Windows) or leave blank if swftools is a known to your system path" type="text" />
      <p><i>You can test if swftools is installed into system path by opening a shell or cmd-prompt and type pdf2swf<br/>
      If this shows a list of options leave this field blank otherwise you have to specify the path to pdf2swf on your system<br/>
      see also <a href="http://incubator.apache.org/openmeetings/installation.html" target="_blank">Installation</a></i></p>
      </li>
      <li>
      <label for="swftools_zoom">SWFTools Zoom</label>
      <input name="swftools_zoom" id="swftools_zoom" size="4" value="100"
      title="Enter the dpi that swftools will use for PDF to SWF conversion" type="text" />
      <p><i>You can test if swftools is installed into system path by opening a shell or cmd-prompt and type pdf2swf<br/>
      Enter the dpi that swftools will use for PDF to SWF conversion. Default is 100 dpi.<br/>
      see also <a href="http://incubator.apache.org/openmeetings/installation.html" target="_blank">Installation</a></i></p>

      </li>
      <li>
      <label for="swftools_jpegquality">SWFTools JPEG Quality</label>
      <input name="swftools_jpegquality" id="swftools_jpegquality" size="3" value="85"
      title="Enter the quality of embedded jpeg pictures to quality. 0 is worst (small), 100 is best (big). (default:85)" type="text" />
      <p>
      <i>You can test if swftools is installed into system path by opening a shell or cmd-prompt and type pdf2swf<br/>
      Enter the quality of embedded jpeg pictures to quality. 0 is worst (small), 100 is best (big). (default:85)<br/>
      see also <a href="http://incubator.apache.org/openmeetings/installation.html" target="_blank">Installation</a></i>
      </p>
      </li>

      =====================================================================================================

      ./src/org/openmeetings/app/installation/ImportInitvalues.java:298:
      ./src/org/openmeetings/app/installation/.svn/text-base/ImportInitvalues.java.svn-base:298

      cfgManagement.addConfByKey(3, "swftools_zoom", cfg.swfZoom, null,
      "dpi for conversion of PDF to SWF");

      cfgManagement.addConfByKey(3, "swftools_jpegquality", cfg.swfJpegQuality, null,
      "compression quality for conversion of PDF to SWF");

      ----------------------------------------------------------------------------------

      ./src/org/openmeetings/app/installation/InstallationConfig.java:20:
      ./src/org/openmeetings/app/installation/.svn/text-base/InstallationConfig.java.svn-base:20:
      //SWFTools PDF to SWF conversion settings
      public String swfZoom = "";
      public String swfJpegQuality = "";

      + ", mailUseTls=" + mailUseTls + ", swfZoom=" + swfZoom
      + ", swfJpegQuality=" + swfJpegQuality + ", swfPath=" + swfPath

      ----------------------------------------------------------------------------------
      ./src/org/openmeetings/servlet/outputhandler/Install.java
      ./src/org/openmeetings/servlet/outputhandler/.svn/text-base/Install.java.svn-base:245

      cfg.swfZoom = httpServletRequest.getParameter("swftools_zoom");
      cfg.swfJpegQuality = httpServletRequest.getParameter("swftools_jpegquality");

      ----------------------------------------------------------------------------------
      =====================================================================================================
      ./src/org/openmeetings/app/documents/GenerateSWF.java:
      ./src/org/openmeetings/app/documents/.svn/text-base/GenerateSWF.java.svn-base:

      private String getSwfZoom() {
      String valueForSwfZoom = cfgManagement.getConfValue("swftools_zoom", String.class, "");
      // WARNING CODE NOT COMPLETE: If SWFTools zoom (dpi) should be an integer between 50 and 600 with a default value of 100 dpi
      if (valueForSwfZoom.equals(""))

      { valueForSwfZoom = "100"; }

      return valueForSwfZoom;
      }

      private String getSwfJpegQuality() {
      String valueForSwfJpegQuality = cfgManagement.getConfValue("swftools_jpegquality", String.class, "");
      // WARNING CODE NOT COMPLETE: If SWFTools JPEG Quality should be an integer between 1 and 100, with a default value of 85
      if (valueForSwfJpegQuality.equals(""))

      { valueForSwfJpegQuality = "85"; }

      return valueForSwfJpegQuality;
      }

      public HashMap<String, String> generateSwf(String current_dir,
      String originalFolder, String destinationFolder, String fileNamePure) {

      // Create the Content of the Converter Script (.bat or .sh File)
      String[] argv = new String[]

      { getPathToSwfTools() + "pdf2swf" + execExt, "-s", "insertstop", // insert Stop command into every frame "-s","poly2bitmap", //http://www.swftools.org/gfx_tutorial.html#Rendering_pages_to_SWF_files "-i", // change draw order to reduce pdf complexity "-j", " " + getSwfJpegQuality(), // JPEG Quality to 100 "-s", " zoom=" + getSwfZoom(), // set zoom dpi to 200 originalFolder + fileNamePure + ".pdf", destinationFolder + fileNamePure + ".swf" }

      ;

      return ProcessHelper.executeScript("generateSwf", argv);
      }

      =====================================================================================================

      Attachments

        1. SwfToolsZoom1.diff
          14 kB
          George Kirkham
        2. zoomfix1.diff
          0.8 kB
          George Kirkham

        Activity

          People

            Unassigned Unassigned
            gkirkham George Kirkham
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: