Link to a pdf file

Enonic version: 6.x
OS: centos

Hi.

On an enonic XP site I upload a pdf file with Content Studio. I would like to make this file readable for public. How can we refer to this file as a link? The file was uploaded as media content.

The designed link would be something like https://www.xxxx.com/support/manual.pdf.
It seems that there is no simple way to do this.

Thanks.

Hi! Use attachmentUrl function to get link to the file. https://developer.enonic.com/docs/xp/stable/api/lib-portal#attachmenturl

On XP 6.x you can combine tsi’s suggestion above with the Attachment Viewer application from Enonic Market, which lets you view the attachmentUrl to the PDF inline in the browser instead of downloading it.

https://market.enonic.com/vendors/enonic/attachment-viewer

(The app has become redundant in Enonic XP 7.x)

1 Like