How do I get Views PDF to Download a file? I am using views-pdf to create a 'ticket' for people. Buy a ticket and they need to keep the ticket on their phone. I am using views-pdf to generate the ticket and would like to automatically trigger the download. 

At the moment I have the following, which is not working:

function yhivepasses_views_pre_render(&amp;$view) {
 if ($view-&gt;name != YOGAHIVE_PASSES_VIEW_NAME || $view-&gt;current_display != YOGAHIVE_PASSES_VIEW_DISPLAY) {
 return;
  }

//'Content-Disposition' =&gt; $disposition . '; filename="' . mime_header_encode($name) . '"',
  drupal_add_http_header('Content-Disposition', 'attachment; filename="yogahivepasses.pdf"');
}
The headers are returned from TCPDF. The argument 'D' for download needs to be passed from views to TCPDF. 

To do this I created a menu entry.

function yhivepasses_menu() {
  $items['yhivepasses/download/yogahive_passes_user_balance/pdf_1/user/%'] = array(
      'title' =&gt; 'YogaHive Passes',
      'page callback' =&gt; '_yhivepasses_views_pdf_download',
      'page arguments' =&gt; array(2,5,5),
      'access arguments' =&gt; array('access checkout'),
  );


Called the view manually.

function _yhivepasses_views_pdf_download($view_id, $views_display, $arguments) {
  if (!empty($view_id)) {
    $view = views_get_view($view_id);
    if (!is_object($view)) {
       drupal_set_message("Sorry, couldn't load your YogaHive Passes.", 'error');
       return FALSE;
     }

    $view-&gt;set_arguments(preg_split("/\r\n|\n|\r/", $arguments));

  if (!$view-&gt;set_display($views_display)) {
    $views_display = 'pdf_1';
    if (!$view-&gt;set_display('pdf_1')) {
      return FALSE;
    }
  }

  $view-&gt;pre_execute();

  $display = $view-&gt;display[$views_display];
  if ($display-&gt;display_plugin == 'pdf' &amp;&amp; isset($display-&gt;handler)) {
    // arguments '' and I
    // Setup rules to take you to the 'completed' page and then do a redirect.
    //header('refresh:0;url=' . $base_url . '/user/14');
     $display-&gt;handler-&gt;execute('', 'D');
     $display-&gt;handler-&gt;post_execute();
    }
  }
}


The way that views-pdf calls views, I don't see a way to set the argument 'D'. There are no hooks, just a conditional call.