Changing page orientation of a pdf of a views generated by the Print module The Print module (https://www.drupal.org/project/print) allows users to generate a PDF of nodes, views and panels. It allows for the selection of a default page orientation (portrait or landscape), and it allows for administrators to override the default orientation in specific nodes.

However, I can't figure out how to override the default orientation when creating a PDF of a specific Views output. I have one View that needs to be printed in landscape format, the rest in portrait. Perhaps a PHP snippet in the header of the view? 

Any help will be appreciated!
If you used MPDF as your library then add this function to your themes' template.php:

function MYTHEME_print_pdf_mpdf_alter(&amp;$mpdf, $html, $meta) {
  //return;
  if(is_view_path()) {
    $paper_size = variable_get('print_pdf_paper_size', PRINT_PDF_PAPER_SIZE_DEFAULT);
    $format = $paper_size . "-L";
    // set document information
    $mpdf = new mPDF('UTF-8', $format);
    $mpdf-&gt;SetAuthor(strip_tags($meta['name']));
    $mpdf-&gt;SetCreator(variable_get('site_name', 'Drupal'));
  }
}


I could not find a way to alter the paper orientation after the object was instantiated, so I opted to just create it again (orientation is set in class creator).

You should then implement a function called is_view_path that returns true if it detect the printpdf path of the view, so that the code only runs for your specific view.

function is_view_path() {
  $path = current_path();
  return $path == 'VIEWPATH'; // just add your view path here
}


If you used TCPDF you should look at the function print_pdf_tcpdf_print_pdf_generate in print-pdf-tcpdf.page.inc at how to instantiate the $pdf object, and then implement an alter hook similarly to what I did above. I could not do it as for some reason I cannot get the tcpdf library to detect.

For DOMPDF I could not find an alter hook.