Image/external css are not loading in Freemarker template

Viewed 392

I have browsed through similar kind of threads here but I see they mainly have single directory structure projects where templates and images are existing in same base project.

I have multiple module/projects under main project and template , image exist in different projects/modules.Please see below project structure:

Main Project
- Commons
  -src
   -main
    -resources
     -templates
      - test.ftl  
- Services
   -static
      -img
      -css
      -js
- Web
   -build
     -img
     -css
     -js
   -public
     -img
        -object.png
     -css 
        -object.css 
     -js
   -node_modules
   -src

In test.ftl, I am trying to access the css like below

<link rel="stylesheet"href="css/object.css"type="text/css">

But I get error as following:

[http-nio-9191-exec-4] ERROR com.itextpdf.html2pdf.css.resolve.DefaultCssResolver - Unable to process external css file
java.io.FileNotFoundException: I:\Workspace\MainProject\css\print.css (The system cannot find the path specified)

It is looking for resources under Main project, I am using Spring-boot so pubic folder should be by default read by ftl file?

I have tried adding '/' in front of the url but that also did not work.

 <img alt="object"src="/img/object.png"/><br/>

Please guide me in this, Thank you.

0 Answers
Related