eZ Community » Forums » General » Important Question about 'PDF'
expandshrink

Important Question about 'PDF'

Important Question about 'PDF'

Friday 05 October 2012 8:21:30 pm - 6 replies

I think my question is so simple but i am stucked and i dont find the solution.

I have a pdf page in my website. a list with the names and dates.

when I click, I want my pdf should be opened in a new window!

But the problem is that i don't find how to do it in ezpublish, 

when i use FILE class , it asks me to save the file which is not what i want, i want it to open in a new window!

i cannot do it in block xml as well. I really dont find what to do and where to find the file that i have put in Media Tab!

Can somebody PLEASE help me !!!

Sunday 07 October 2012 2:33:18 am

HI.

First off, the end result of how different browsers open a PDF are *highly dependent* on the particular browser and PDF viewer installed. Different headers produce different results.

In eZ publish, I believe the content/download sends "Application/Octet-stream" to specifically force a download:

If you are simply trying to have the PDF open in a new tab:

  • create a link using the original file path
  • Set the target to _blank

Example:

http://www.thebrokeronline.eu/

Look at the blue box on the right and click on the PDF link.

 

It is not foolproof (the only 100% solution to showing in a browser for sure is an embeded viewer). However, In most browsers, this will be enough.

Monday 08 October 2012 10:37:01 am

David ,

Thank you very much ,the example that u mentioned was exactly what i need.

But I think the most important problem is that i dont find where the file is been stored in ezpublish!

With my debugger i found this link:

/content/download/1325/12332/file/mypdf.pdf

then when i use target="_blank" it still download the file in all the browsers. thats why i think i havent found the real place where the file is stored!

I tried <object> and <embed> as well they work, but i have problem of browsers.

Monday 08 October 2012 12:02:57 pm

Hello,

The url "/content/download/1325/12332/file/mypdf.pdf" is used for calling the view "Download" in the module "Content", this view is created to download files blunk.gif Emoticon

Whatever you can have the exact url  by :  $object.data_map.mypdf.content.file.filepath  (where mypdf is the identifier of your attribute)

tks

Modified on Monday 08 October 2012 12:05:21 pm by Abdelkader RHOUATI

Monday 08 October 2012 2:43:54 pm

Abdelkader ; thank so much 

I found out where it is stored , ok ,

http://www.mysite.com/var/ezwebin_site/storage/original/application/5273947ebb6ebbad1a8fae82afb540c6.pdf

 

but when i try to have a link to this file i have an error:

Error: error/view.php Oct 08 2012 14:34:54
Error ocurred using URI: /var/ezwebin_site/storage/original/application/5273947ebb6ebbad1a8fae82afb540c6.pdf
Error: index Oct 08 2012 14:49:27
Undefined module: var

And in the page i have :

Module not found!

do you have any suggestion! I am really stucked!

Modified on Monday 08 October 2012 2:56:24 pm by pa bl

Monday 08 October 2012 3:16:59 pm

Hiya.

Well, this is a good learning item:
If you ever see module not found, and the 'module' is part of a path to static content, then there is a 99 percent chance that the issue is simply a rewrite rule mismatch happy.gif Emoticon
How it works for standard eZP installs:
.htaccess allows a whole bunch of content through by pattern matching

Then in the end, what is left is run through index.php
So, in your case, your URL never matched an allowable pattern and eZPublish is trying to find a module called var (the first part of your URL)
so, you can fix this by fining an existing rewrite rule, copying it and replacing part of it with:

/var/ezwebin_site/storage/original/application/

So, Something like:

RewriteRule ^/var/ezwebin_site/storage/original/application/.* - [L]

OR Maybe (depending on your setup)

RewriteRule var/ezwebin_site/storage/original/application/.* - [L]

 

Those rules with the 'L' match and then stop processing - thus never making it to index.pjp.

 

But wait!  There's more!

Look at the existing rules.. one of them can surely be adjusted to meet this criteria with a modification (multiple depth  or other wildcards, etc), so one you get it working with something like the above, see if you could have just re-used an existing one making it more flexible happy.gif Emoticon

 

 

 

Modified on Monday 08 October 2012 3:18:45 pm by David Ennis

Monday 08 October 2012 4:57:43 pm

That was it! Thank you so much.

i learnt many things that i couldnt find in documentation!

Cheers

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from