Search code examples
javahtmlliferayliferay-7

Liferay 7.1 - How to add a link html for a pdf file


I have a main module C-portlet that contains in the folder resources a pdf file.

resources/webapp/files/cg.pdf

I have a war theme. In one of its jsp page, i need to add a link for the cg.pdf.

For now, i have :

<a target="_blank" href="/o/Cportlet/src/main/resources/META-INF/resources/webapp/files/cg.pdf"><liferay-ui:message key="cg-link"/></a>

but it doesn't work.

Last point, this pdf could be changed at anytime without a deploy again a module / war.

Is anyone have an idea ?

Thanks


Solution

  • You can put your pdf file in one of your theme resource folders (for example the "templates" folder).

    Now you can use themeDisplay.getPathThemeTemplates() + "/cg.pdf" or within your theme with freemarker "${templates_folder}/cg.pdf"