Export PDF in Landscape

I would like to know if it is possible to configure the export as PDF button for producing a landscape page by default. I know that we can use the print functionality for this, but the format (has borders) is uggly this way.


Hello @bgeneto ,

You can do that by going to vendor/grocery-crud/enterprise/src/GroceryCrud/Views/export-pdf.php at around line 89 and change the line:

var doc = new jsPDF();


    var doc = new jsPDF({
        orientation: 'l',

If you would like to have this change permanent, then you can change the default pdf state with yours. There are instructions of how to replace the default state by using replaceState in your particular example, you can basically copy the code from vendor/grocery-crud/enterprise/src/GroceryCrud/Core/State/ExportPdfState.php and replace the line 26:

echo $this->gCrud->getLayout()->themeView('export-pdf.php', $output, true);

with your own view which can be in your project files.


1 Like

Unfortunately my own view cannot be in my project directory because themeView method uses _viewsPath internaly and it search for a view inside src/GroceryCrud/Views/ directory :frowning:

Hey @bgeneto ,

I forgot to mention that this is available at the latest version so you don’t have to add your own view :slight_smile: . Just download the latest version :slight_smile: