Project

General

Profile

Is their a way to have Redmine open pdf files in the browser?

Added by Geoffrey Van Wyk about 13 years ago

I am referring to the files that one uploads to an issue. Redmine does open txt and html files in the browser, but not pdfs.

I searched the Web for a plugin but it does not seem to exist.


Replies (9)

RE: Is their a way to have Redmine open pdf files in the browser? - Added by Joaquim Homrighausen about 13 years ago

Isn't this an issue with your web browser, rather than with rm?

-joho

RE: Is their a way to have Redmine open pdf files in the browser? - Added by Geoffrey Van Wyk about 13 years ago

The same thing happens in Internet Explorer 8 and in Firefox 6.

RE: Is their a way to have Redmine open pdf files in the browser? - Added by Steven Wong about 13 years ago

you should install the adobe reader and then it supports open pdf files in IE.

RE: Is their a way to have Redmine open pdf files in the browser? - Added by Geoffrey Van Wyk about 13 years ago

Hi Steven,

I do have Adobe Reader, and I can open pdfs in the browser from other sites, but not from my local Redmine. My local Redmine brings up the File Download dialog that asks whether I want to open or save the file.

RE: Is their a way to have Redmine open pdf files in the browser? - Added by Keul Keul almost 13 years ago

Seems to be a problem with http header "disposition-type" setting: http://www.ietf.org/rfc/rfc1806.txt

Look at the HTTP header : "disposition-type inline/attachment" and try to set it to inline
(use this extension for tests : https://addons.mozilla.org/fr/firefox/addon/live-http-headers/ )

RE: Is their a way to have Redmine open pdf files in the browser? - Added by Joel Jensen about 11 years ago

I hacked this on pretty easily (Sorry I don't have time to make a patch file right now)
Also I have no ruby skills.

Add to app/models/attachment.rb, somewhere next to def thumbnailable:

def pdf?
!!(self.filename =~ /\.(pdf)$/i)
end

Then modify app/controllers/attachments_controller.rb:
Change the line:

:disposition => (@attachment.image? ? 'inline' : 'attachment')

to

:disposition => (@attachment.image? || @attachment.pdf? ? 'inline' : 'attachment')

RE: Is their a way to have Redmine open pdf files in the browser? - Added by jean forichon about 10 years ago

Thanks. I am using Bitnami Redmine and had no issue implementing that.
The location of the files is just different:

X:\Bitnami\redmine\apps\redmine\htdocs\app\controllers
X:\Bitnami\redmine\apps\redmine\htdocs\app\models

RE: Is their a way to have Redmine open pdf files in the browser? - Added by Maik Lindner almost 9 years ago

Works perfectly! Thank you Joel. This should be default or at least available as an option in redmine.

    (1-9/9)