To generate an Image from an HTML report you have to configure the next steps:
set the option <generateImage>format</generateImage> in the declarations section of the report module
<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>png</generateImage> <templateDir>$REPORT_TEMPLATE_DIR$</templateDir> <reportsRootDir>$REPORT_ROOT_DIR$</reportsRootDir> <reportsRootSubDir>nl/fluvial</reportsRootSubDir> <sendToLocalFileSystem>true</sendToLocalFileSystem> <timeZone .. <locale .... </declarations>
- 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.
- 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.
Currently the wkhtmltoimage program is used. See attached a complete version as to be used with FEWS.
N.B.: The htm 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 to add specific options for the conversion tool used (i.e. --width 720 -heigt 1024)
The image formats supported by wkthtmltoimage are jpg, png, svg, bmp.