0

I'm adapting a drupal module to my need. It permit to upload a pdf to insert it into a node add form in an iframe to display the file. I've need also to insert a link to download the previous uploaded file.

I've read and try thousand of guide and documentation but nothing that work or adapt to my scope.

Is possible to find an easy way to create by code a download link?

3
  • Could you add some of your code to your question? It would be very helpful to figure out where to hook in exactly.
    – leymannx
    Sep 23, 2015 at 19:21
  • this is the main part, the $content will print into the nodd/add form $content = '<a href="'.$filelink.'">Download MB</a><br><br><iframe frameborder="0" width="800px" height="900px" src="'.$path.'"><p>'.$file_text.'</p></iframe>'; i need to create $filelink to start file download
    – Michele S
    Sep 24, 2015 at 9:57
  • Please add that code to the question, not in into a comment. So you are in a template? What template?
    – leymannx
    Sep 24, 2015 at 9:58

2 Answers 2

0

It sounds like you're looking for the PDF Reader module.

PDF Reader will render your entity file fields with the selected PDF renderer.

The implemented PDF renderers are:

  • Google Docs Viewer
  • pdf.js - PDF Reader in JavaScript
  • Direct PDF embed
  • Microsoft Office Web Viewer(7.x-2.x-dev)

This module lets you specify any file field to render as a PDF embedded in a node. It also has an option to display download link for the embedded PDF.

1
  • No, this is not what i need. i want to display contentin the same page, with iframe and also insert a force download link
    – Michele S
    Sep 24, 2015 at 7:16
-1

You can use below HTML to download files:

$content = "<a href='FILE LINK' download='FILE NAME TO DOWNLOAD WITH EXTENSION'">Click here to download</a>';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.