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

Can I ask a follow up question to this. You write that the app will be redundant in XP7, is that because there is an integrated pdf viewer already?

Indeed, in XP7 PDFs are rendered in the preview window just like images are.