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

  1. set the option <generatePdf>true</generatePdf> 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>
    
       <generatePdf>true</generatePdf>
       <generatePdfCommandLineOptions>--orientation Landscape</generatePdfCommandLineOptions>  
    
       <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_HTML2PDF_PROGRAM should be defined.
    For example to REPORT_HTML2PDF_PROGRAM=%REGION_HOME%/Modules/Reports/bin/wkhtmltopdf.exe

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

Notes:

  • The wkhtmltopdf application is known to crash if spaces are used in the directory names of the fews client.
  • If you want to reference images in the HTML which you export when you make the reports you must include the argument --enable-local-file-access
  • With the generatePdfCommandLineOptions element in the schema it is posible to add specific functionality. More info can be found in the wkhtmltopdf.txt file.


  • No labels