Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

To generate an Image from an HTML report you have to configure the next steps:

  1. set the option <generateImage>format<generateImage><format>format</format></generateImage> in the declarations section of the report module

    Code Block
    xml
    xml
    <reports ......>
     <declarations>
       <chartFormat id="chartFormat1"> ....    </chartFormat>
       <summaryFormat id="formatStatusMap"> ....    </summaryFormat>
       <htmlTableFormat id="htmlTableFormat1NL" tableStyle="tableStyle1"> ....    </htmlTableFormat>
       <dateFormat id="dateFormat1"> ...  </dateFormat>
       <numberFormat id="numberFormat1"> ... </numberFormat>
    
       <generateImage>
         <format>jpg</format>
       <generateImage>png<  <options>--width 720 --quality 50</options>
       </generateImage>
    
       <templateDir>$REPORT_TEMPLATE_DIR$</templateDir>
       <reportsRootDir>$REPORT_ROOT_DIR$</reportsRootDir>
       <reportsRootSubDir>nl/fluvial</reportsRootSubDir>
    
       <sendToLocalFileSystem>true</sendToLocalFileSystem>
    
       <timeZone ..
       <locale ....
     </declarations>
    


  2. Note that the option sendToLocalFileSystem should be set to true. To generate an Image from reports (zip files) stored in the database, you can configure a similar option in the ReportExport configuration.
  3. in the global.properties the option REPORT_HTML2IMG_PROGRAM should be defined.
    For example to REPORT_HTML2IMG_PROGRAM=%REGION_HOME%/Modules/Reports/bin/wkhtmltoimage.cmd
    See attached the binaries.exe

The generateImage element has two configuration elements:

format

Configure the output format, by giving the three-letter file extension typically used, The image formats supported by wkthtmltoimage are JPG, PNG, SVG, BMP. The default format is JPG.

options

Configure specific options, that are to be added to the command line (before the input / output arguments). Typically this is used to control image size and quality, as in the example given above.


Currently the wkhtmltoimage program is used, which is available for windows and various linux distributions

N.B.: The html to image conversion tool will be run with 2 arguments, ie. wkhtmltoimage <input-html file> <output-image-file> and in order to be able to add specific program options, a batch or shell script file can be called instead (by changing the REPORT_HTML2IMG_PROGRAM property to point to the batch fille/shell script instead of the wkhtmltoimage executable) to add specific options for the conversion tool used (i.e. --width 720 -height 1024)an <options> element can be added that inserts the options given on the command line (before the 2 input / output arguments).

The image formats supported by wkthtmltoimage are jpg, png, svg, bmp.

...