Open PDF Files instead of downloading them
-
- Phoca Member
- Posts: 11
- Joined: 06 Jun 2020, 18:09
Open PDF Files instead of downloading them
I've just installed phocadownload so may have missed something.
I'd like to be able to open and view pdf files in the browser rather than have them downloaded.
I know browsers can be set up to do this but that relies on users knowing how to do this. Another extension I use opens the file rather than downloads it, so it must be possible
I'd like to be able to open and view pdf files in the browser rather than have them downloaded.
I know browsers can be set up to do this but that relies on users knowing how to do this. Another extension I use opens the file rather than downloads it, so it must be possible
Tags:
- Benno
- Phoca Hero
- Posts: 9442
- Joined: 04 Dec 2008, 11:58
- Location: Germany
- Contact:
-
- Phoca Member
- Posts: 11
- Joined: 06 Jun 2020, 18:09
Re: Open PDF Files instead of downloading them
Benno , thank you for your help
Is there any way to only have the preview button and suppress the download option, other than using a customised layout
Kind Regards
Dave
Is there any way to only have the preview button and suppress the download option, other than using a customised layout
Kind Regards
Dave
- Benno
- Phoca Hero
- Posts: 9442
- Joined: 04 Dec 2008, 11:58
- Location: Germany
- Contact:
Re: Open PDF Files instead of downloading them
Hi,
no, I do not know a way to hide the download button in the options.
So only CSS remains.
Kind regards,
Benno
no, I do not know a way to hide the download button in the options.
So only CSS remains.
Kind regards,
Benno
-
- Phoca Hero
- Posts: 2819
- Joined: 28 Nov 2010, 17:20
Re: Open PDF Files instead of downloading them
Hi,
as Benno wrote, via CSS, example from a demo, as live site not available:
or via Template Override from:
/components\com_phocadownload\views\category\tmpl\default_files.php
belongs apprx. to these lines:
e.g. to comment out.
if using Bootstrap Output:
components\com_phocadownload\views\category\tmpl\default_files_bootstrap.php
to:
templates/your_template/html/com_phocadownload/category/directory
Kind regards
Christine
as Benno wrote, via CSS, example from a demo, as live site not available:
Code: Select all
.pd-button-download {
display:none;
}
/components\com_phocadownload\views\category\tmpl\default_files.php
belongs apprx. to these lines:
Code: Select all
// pdbuttondownload
$pdButtonDownload = '<div class="pd-button-download">';
$pdButtonDownload .= str_replace('class=""', 'class="'.$cBtnSuccess.'"', $linkDownloadB) . JText::_('COM_PHOCADOWNLOAD_DOWNLOAD') .$linkDownloadE;
$pdButtonDownload .= '</div>';
if using Bootstrap Output:
components\com_phocadownload\views\category\tmpl\default_files_bootstrap.php
to:
templates/your_template/html/com_phocadownload/category/directory
Kind regards
Christine
-
- Phoca Member
- Posts: 11
- Joined: 06 Jun 2020, 18:09
Re: Open PDF Files instead of downloading them
Thanks, another question
- do you know the routine that invokes the actual download of the file. I'm wondering if its possible to change the behaviour so the browser decides whether to do a download or process the file (eg display a pdf file) rather than a download happenig every time.
-i'm wondering if this is could be used as an alternative to view - which doesnt appear to work on an _ _ or _ _ as only the first page gets displayed.
- do you know the routine that invokes the actual download of the file. I'm wondering if its possible to change the behaviour so the browser decides whether to do a download or process the file (eg display a pdf file) rather than a download happenig every time.
-i'm wondering if this is could be used as an alternative to view - which doesnt appear to work on an _ _ or _ _ as only the first page gets displayed.
- Jan
- Phoca Hero
- Posts: 48402
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Open PDF Files instead of downloading them
Hi, the main function of the component is download component. So it means, it tries to force downloading the file before displaying it when the download button is clicked.
Everything with download happens here:
administrator\components\com_phocadownload\libraries\phocadownload\download\download.php
including the setting of header which tries to force downloading instead of displaying, etc.
So if there should be done some changes, then in this file.
Jan
Everything with download happens here:
administrator\components\com_phocadownload\libraries\phocadownload\download\download.php
including the setting of header which tries to force downloading instead of displaying, etc.
So if there should be done some changes, then in this file.
Jan
If you find Phoca extensions useful, please support the project
-
- Phoca Member
- Posts: 11
- Joined: 06 Jun 2020, 18:09
Re: Open PDF Files instead of downloading them
Jan
thank you - I will take a look
thank you - I will take a look
-
- Phoca Member
- Posts: 11
- Joined: 06 Jun 2020, 18:09
Re: Open PDF Files instead of downloading them
Jan.
thanks for you advice - by changing 'content-disposition: attachment' to 'content-disposition: inline' I can now view the file rather than downloading it when the download button is clicked. The advantage of this is 'viewing' is now controlled by security constraints so the file can be in a protected directory outside of public_html or controlled by .htaccess and stopping direct downloads using a URL in the browser.
Maybe the inline option could be considered as a configuration option for a future release.
As an aside the forum search appears to only display the first few results and I cannot see a way to scroll furhter down?
Dave
thanks for you advice - by changing 'content-disposition: attachment' to 'content-disposition: inline' I can now view the file rather than downloading it when the download button is clicked. The advantage of this is 'viewing' is now controlled by security constraints so the file can be in a protected directory outside of public_html or controlled by .htaccess and stopping direct downloads using a URL in the browser.
Maybe the inline option could be considered as a configuration option for a future release.
As an aside the forum search appears to only display the first few results and I cannot see a way to scroll furhter down?
Dave
- Jan
- Phoca Hero
- Posts: 48402
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Open PDF Files instead of downloading them
Hi, Ok, added to feature request list.
Forum - do you get any Javascript error? Which browser do you use?
Jan
Forum - do you get any Javascript error? Which browser do you use?
Jan
If you find Phoca extensions useful, please support the project