TLDR: How to send Module "Views PDF Display" generated PDF by mail as attachment without another deprecated module ?

I have a Drupal site with the Views PDF Display module on it.

I can generate a custom PDF for my order, and all is nice, except for one things. I need to send those PDF one by one by mail as attached file for the past year of commands, and i looked around for a while without seeing an answer.

I found that one the module page, they talk about two modules that does that, but the fact that both modules are 7 years old and thus not covered by security policy is a 'no'

Other idea to generate all PDF from the last year is just not possible as it will be too much PDF for the server to handle

Do you have any idea for me to retrieve those PDF from the views and to send them by mail as an attachment ?

  • Which module are you talking about? Maybe link to the project page. (I only know about the "Views PDF" module.) If you explain some more about the actual Views - what they contain (which fields) - it might be easier to help you.
    – hansfn
    Commented Mar 22, 2019 at 22:50
  • the module i'm talking about is drupal.org/project/views_pdf
    – Fofw
    Commented Mar 25, 2019 at 9:22

1 Answer 1


I tried a couple of things with views directly, but I had no luck, so I turned to curl. You can create your pdf display and give it a path. Hit that path with curl to download the file that will be generated by your view. My example below is pretty simple, but you can pass arguments with the url just like you would normally.

 $pdf_page = "http://yourplace.net/pdf";
  $pdf_file = fopen('/tmp/my.pdf', 'w');
  $ch = curl_init($pdf_page);
  curl_setopt($ch, CURLOPT_FILE, $pdf_file);
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

I tested this with a pdf display built on Views PDF and it worked well. Maybe someone has an answer that utilizes views directly instead of using curl.

  • doesn't seems to be working on my site. File is created, but no data is inserted inside despite the correct URL being set.
    – Fofw
    Commented Mar 25, 2019 at 9:32
  • Can you post your code? Do you have any error messages in the Apache logs or watchdog?
    – Quint
    Commented Mar 25, 2019 at 14:06

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.