Reviewed & tested by the community
Project:
Pdfview
Version:
5.x-1.x-dev
Component:
User interface
Priority:
Minor
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
24 Jan 2007 at 17:53 UTC
Updated:
28 Jan 2009 at 16:14 UTC
for the average user, is more friendly open the pdf in a new navigator window. I include the code that does so.
added target=_blank,
******* code ****************************
/**
* Theme a Pdfview link
* @ingroup themeable
*/
function theme_pdfview_link($node) {
if ((user_access('access content as PDF') || user_access('administer nodes'))
&& variable_get('pdfview_'.$node->type, 1) == 1) {
$attributes = array("title" => t('Display a PDF version of this
page.'),"target" => t('_blank'));
$links = l(t('download PDF'), "node/$node->nid/pdf", $attributes);
}
return $links;
}
******* code end l****************************
Comments
Comment #1
Egon Bianchet commentedIt's up to the user to set up his browser to do that
Comment #2
rconstantine commentedWhat do you mean it's up to the user to set his browser to do it? It's fairly customary when moving away from an HTML page to something else to open it in another window or tab, just as the code above suggests. This is a good addition and works.
Comment #3
falconerc commentedWhile yes, you can use a setting to open windows in a new tab / window in the preferences in most browsers, what is being talked about here is instead of navigating away from the page where the .pdf document is referenced, it will automagically open a new tab in which the .pdf document is displayed, thereby keeping the original page up for the user to see.
Comment #4
doualiya commentedWhere do I have to put this code ?
Thanks