Manage Files not allowing rendering of PDFs

29 views
Skip to first unread message

John Watts

unread,
May 25, 2023, 12:36:43 PM5/25/23
to xnat_discussion
Hello All,
I've defined a project resource at the image session level so I can use the ''Upload Addition files" option to upload redacted PDF imaging reports. These upload fine and then they are visible in the file manager for the session in question. When I click on the link to the PDF the file downloads but I want this to open in a separate window or browser tab as when I click on a link to a single image within the session.

I'm using Chrome I have installed the PDF extension.
I'm running a fresh 1.8.8 in docker on my local machine

I have tried:
Allowing browser rendering as per https://wiki.xnat.org/documentation/xnat-administration/how-to-restrict-rendering-of-xnat-resources with both 'pdf' added to the white list and with just '*' in the list. 

I have also tried inspecting the code to see that the image download does which uses ....
<a onclick="window.open('uri?format=image/jpeg'); return false;">Image</a>

I tried manually editing the HTLM for the pdf in inspect which looks like this...
<a target="_blank" onclick="location.href='/data/experiments/XNAT_test1_E00012/resources/30/files/XNAT-OpenClinica.pdf';">XNAT-OpenClinica.&shy;pdf</a>
... with the onclick="window.open... but I got the same download behaviour. I'm certainly not a HTML/ Javascript person so I'm not that surprised it didnt work, but hey, it was worth a shot!

Would be great if anyone has any pointers as how I can get PDFs to open and not download.

Regards
John 




Charlie Moore

unread,
May 25, 2023, 5:37:02 PM5/25/23
to xnat_discussion
Hi John,

I haven't been able to recreate this. Is there any chance that the PDF extension you mention is actually interfering here? I'm able to see the rendered PDF just fine in Chrome without any sort of extension.

Thanks,
Charlie Moore

John Watts

unread,
May 26, 2023, 7:17:21 AM5/26/23
to xnat_discussion
Hi,
one think I forgot to mention, my Docker instance is running under WSL, could this be an issue? I will also try removing the Chrome PDF extension although the download was the behaviour without it installed but I hadnt added PDFs to the mime white list.

Reply all
Reply to author
Forward
0 new messages