Open PDF directly in a new browser window from link in OE

Author Message

Siw Helen Thorslund

Wednesday 26 April 2006 1:19:24 pm

Maybe this is a stupid question, but I just can't remember how to open a PDF directly in a new browser window from link in Online Editor.

I'm using this code:

Read the <link href='ezobject://373' target='_blank'>PDF</link> here.

Any idea how to get this to work?

I do not want to open the full view of PDF, but the direct link to the file...

www.VZT.no ( http://www.VZT.no )
VZT References ( http://http://vzt.no/index.php/vzt_eng/referanser )
VZT Extensions ( http://vzt.no/index.php/vzt_eng/extensions )
www.MediaBase.no ( http://www.MediaBase.no )

Łukasz Serwatka

Wednesday 26 April 2006 11:22:32 pm

Hi Siw,

You will need to use content/pdf/<node_id> and generate PDF file on the fly.

Read the <link href='content/pdf/<node_id>' target='_blank'>PDF</link> here.

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Siw Helen Thorslund

Thursday 27 April 2006 1:50:31 am

I do not want that article as an pdf, but I want the link to a certain pdf uploaded in the media gallery. The link to where it is located in the var directory. How to do this as easy for the user as possible?

www.VZT.no ( http://www.VZT.no )
VZT References ( http://http://vzt.no/index.php/vzt_eng/referanser )
VZT Extensions ( http://vzt.no/index.php/vzt_eng/extensions )
www.MediaBase.no ( http://www.MediaBase.no )

Vicente Olivan

Thursday 27 April 2006 2:29:31 am

It would have to work.

Test also:

 

Read the <link href='eznode://373' target='_blank'>PDF</link> here. 
 

Regadrs

Łukasz Serwatka

Thursday 27 April 2006 2:30:40 am

User can use /content/download/2241/22891 instead of /content/download/2241/22891/version/1/file/file.pdf. So basically have to remember object_id and attribute_id. With ezobject and eznode you can link to object/node not to attribute of object. There is no easy way to do this. Furthermore uploaded files are renamed (ezbinaryfile) e.g var/plain/storage/original/application/0dd976dd601a968d7dda515340dc5939.pdf all information are in database and eZ publish download module hadle it.

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Siw Helen Thorslund

Thursday 27 April 2006 12:30:38 pm

That works, but is not a very good solution for the users.
But I guess I have to do it this way for now...

What about having it to open directly in the browser window?
Not for download like the code in the example; /content/download/2241/22891.

I tried; /content/view/full/2241/22891, but no luck.

(Still the problem is within Online Editor)

Any suggestions?

www.VZT.no ( http://www.VZT.no )
VZT References ( http://http://vzt.no/index.php/vzt_eng/referanser )
VZT Extensions ( http://vzt.no/index.php/vzt_eng/extensions )
www.MediaBase.no ( http://www.MediaBase.no )

Siw Helen Thorslund

Wednesday 31 May 2006 5:34:09 pm

This is still not a very good solution for the users.

I have tried something like:

{section show=$href|contains("pdf")}

	PDF <a href={$href|ezroot()}{section show=$id} id="{$id}"{/section}{section show=$title} title="{$title}"{/section}{section show=$target} target="{$target}"{/section}{section show=ne($classification|trim,'')} class="{$classification|wash}"{/section}>{$content}</a>

{section-else}

	OTHER <a href={$href|ezurl}{section show=$id} id="{$id}"{/section}{section show=$title} title="{$title}"{/section}{section show=$target} target="{$target}"{/section}{section show=ne($classification|trim,'')} class="{$classification|wash}"{/section}>{$content}</a>

{/section}

I need for the PDF to direct to it's filepath to directly open it, and not end up with linking to the full view of the object.

In ezxhtmlxmloutput.php handler, I can see only 'href', 'target', 'classification', 'title', 'content', and 'id' ... which are of no use.

Anyone with a good idea how to solve this?

www.VZT.no ( http://www.VZT.no )
VZT References ( http://http://vzt.no/index.php/vzt_eng/referanser )
VZT Extensions ( http://vzt.no/index.php/vzt_eng/extensions )
www.MediaBase.no ( http://www.MediaBase.no )

Heiner Wurbs

Tuesday 29 August 2006 3:13:41 am

This is a solution, not perfect, but it works

{section show=$href|contains("pdfdownloads")} 
	{def $my_node=fetch( 'content', 'node', hash( 'node_path', $href ) )}
	{*again a condition, to be sure, it is a pdf file*}
	
	{section show=$my_node.object.data_map.file.content.original_filename|ends_with( '.pdf' )}
		<a href=/content/download/{$my_node.object.data_map.file.contentobject_id}/{$my_node.object.data_map.file.id}/file/{$my_node.object.data_map.file.content.original_filename }>{$content|wash( xhtml )}</a>
	{section-else}
		<a href={$href|ezurl}{section show=$id} id="{$id}"{/section}{section show=$title} title="{$title}"{/section}{section show=$target} target="{$target}"{/section}{section show=ne($classification|trim,'')} class="{$classification|wash}"{/section}>{$content}</a>
	{/section}
{section-else}
	<a href={$href|ezurl}{section show=$id} id="{$id}"{/section}{section show=$title} title="{$title}"{/section}{section show=$target} target="{$target}"{/section}{section show=ne($classification|trim,'')} class="{$classification|wash}"{/section}>{$content}</a>
{/section}

it fetches the node by the $href, which is my case sth like media/pdfdownloads/myfiles/mypdf.pdf

To be sure, that it is a pdf, I added an ends_with condition.

Greetings
Heiner

PS: this is definitiv more comfortable for users than an object relation. The user can simply add a link on any text or object and search for a node or object

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.