I need a download button or just the regular link, so the user can both see the document, but also download it just by clicking on the file link.

Comments

damiandab’s picture

+1

damiandab’s picture

Category: bug » feature
Status: Active » Needs review

here the solution: add to pdf_reader.module the download link, here example for google viewer:
Line:123

/**
 * Theme the field with pdf reader
 */
function theme_pdf_reader($variables) {
  switch ($variables['settings']['renderer']) {
    case 0:
    default:
      $output = '<iframe src="http://docs.google.com/viewer?embedded=true&url='
              . urlencode(file_create_url($variables['file']['uri']))
              . '" width="' . $variables['settings']['pdf_width']
              . '" height="' . $variables['settings']['pdf_height']
              . '" style="border: none;"></iframe>'
              . '<p> ' . l(t('Click here to download the PDF file.'), file_create_url($variables['file']['uri'])) . '</p>';
      break;

damiandab’s picture

if you would like to customize the look of download link , add the class to paragraph tag:


. '<p class="pdf-link"> ' . l(t('Click here to download the PDF file.'), file_create_url($variables['file']['uri'])) . '</p>';

cfleek’s picture

I'm receiving an error when I try this: Parse error: syntax error, unexpected '.' in...modules/pdf_reader/pdf_reader.module on line 135

Am I supposed to enter a path to the file or put a link in or?

damiandab’s picture

did you remove semicolon from

. '" style="border: none;"></iframe>' 

I will try to write a proper patch for that.

For me is working: http://www.apfel-bohnsdorf.de/download/apfel-uni

cfleek’s picture

That was it, thanks for pointing that out!

victorcoder’s picture

Assigned: Unassigned » victorcoder
Status: Needs review » Fixed
victorcoder’s picture

Implemented in beta4

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.