10 years ago
Topic

Bonjour,

J'ai un champ de type media dans lequel j'importe des fichier PDF.

Mon problème c'est que sur le frontend quand on clique sur le lien ça le télécharge, j'aimerai qu'il s'ouvre dans le navigateur.

Comment faire, faut-il utiliser un autre champ qui a pour fonction de l'ouvrir ou peut-il être paramétrer directement ?

Get a Book for SEBLOD
46 Posts
Castor
10 years ago
3
Level 1

Hi Sciuridae,

you have to define this in your browser. See:

http://helpx.adobe.com/acrobat/using/display-pdf-browser-acrobat-xi.html

When you click a PDF link on a web page, it can open either within the web browser or directly in Acrobat or Reader. Each browser has its own settings to control how PDFs open from a web page. Acrobat XI and Reader XI do not include a preference setting to open web-based PDFs. To change the display behavior, follow the instructions below for your browser, or see the browser documentation on how to control plug-ins or add-ons...
10 years ago
2
Level 2

Hi Castor and thank you for your answer,

I don't think that it is a browser configuration problem because in others website it's work fine.

my link look like this :

href="/Joomla_3.3.0-Stable-Full_Package_French_v1/index.php/component/cck/?task=download&file=med_pdf&id=35"

the parameter task=download must be added by seblod or by the template I currently use : protostar

and this is the same with beez3 ! that's why I think it's come from how I display the field with seblod.

46 Posts
Castor
10 years ago
1
Level 3

Hi Sciuridae,

this is the normal behavior for this plugin upload_file. The plugin create this link. Once clicked this link starts the controller form SEBLOD and the controller.php starts the download.php, boths scripts you can find in the directory: yoursite/components/com_cck/

In the donload.php you can see at line 13:

'pdf' => 'application/pdf',

This means the browser decides according to its settings.

You can change line 71 from donload.php, but I do not recommend this.

From:

header( "Content-Disposition: attachment; filename=\"$name\"" );

To:

header( "Content-Disposition: inline; filename=\"$name\"" );

in order to force to display the file in the browser.

10 years ago
0
Level 4

If you don't recommend I won't do it.

since we can't put a PDF in a media field and can't set a link to open a PDF from an import field, the only solution I found is to use a link field and import inside the path to the document.

I wish I could set a default folder where I can put all my PDF so I would just have to import the name of the file...

Or if it's possible, use the both fields (transfer and link) with the link refer to the transfered document.

10 years ago
0
Level 1

Finaly I find the way to put a link on a transfered document.

I just add an HTML link on my field on my view like that :

<a href="/$cck->getValue('my_document_path');">open the document</a>

for that the document need to be saved with is full path !

I don't know if it's the best way to do it because it's refer to himself but it's work fine for me.

Get a Book for SEBLOD