Report CSS files location

I’m looking for a way to create some standard CSS files for my HTML->PDF reports. This way I can reuse the CSS to give a consistent styling to the different reports I am generating. I don’t want to put it in my themes directories as the look of the reports is independent of the visual theme that the user chooses. Where should I save the CSS file? And how do I reference it from the tag in my HTML? I’m hoping there is a way to do it that does not require me to hard code the context path into the tag.

A relative path is relative to the tomcat bin folder. Which makes sense because that’s where the bootstrap.jar is. But I’m at a loss as to how to navigate around that path in an abstract way that is not dependent on the tomcat configuration.

Hello, @wwnjj13

You can create a groovy DataSet in a Root-band that will load your styles (for example from service) and return them as a string. And in the HTML-template you will output styles to the template.

Root dataSet:


def service = AppBeans.get('report_StyleService')

return [[
    "style": service.getStyle()


    <title> Report for entity "User" </title>
    <style type="text/css">


I like this solution. I decided to store the styling information as application properties and read that in to the groovy script.

A similar question: What about reusable images? Again, not dependent on the visual theme. Things like the company logo (not the app logo), icons (for shipping carriers or other uses), etc.? This is for things like invoices, packing slips, purchase orders, audit/history/projection reports, etc.

I should note, my reports use HTML templates.

I added it as a parameter to the report:

reportParams.put("deiLogoBytes", Base64.getEncoder().encodeToString( getFileDescriptorByteArray( getDeiLogoFileDescriptor() ) ) );

And this to the template:

<img src="data:image/gif;base64,${Root.fields.deiLogoBytes}"/>