Changing the orientation of a PDF from portrait to landscape

If you are using the DataTables View layout, you export your visible entries to a PDF, however, this PDF is formatted in portrait mode.

If your View has lots of columns, this portrait mode can't quite accommodate all the information available, therefore we need to change its orientation to landscape.

Here's how:

add_filter('gravityview/datatables/button_pdf','gravityview_landscape_pdf', 10 ,2);
function gravityview_landscape_pdf( $button_config = array(), $view_id){
	if( $view_id == 19 ) {
		$button_config['orientation'] = 'landscape';	
	return $button_config;

Make sure to replace " 19" to your specific View ID, this way, only that View will have the PDF in portrait mode.

Learn where to add this code sample:  Where do I add the code samples you share?

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us