I am seeing an issue with how the Kartik Gridview and Exporter works. I can create and render the grid with no issue, can enable and disable the various export formats. But when I try to set PDf Config options the PDF is rendered the same. Cannot change size, orientation,title, subject,etc. I can confirm the export is seeing the options, but it seems those settings are not saving prior to generating the PDF or they are getting overridden.
I have seen this same question presented on git hub but there is not been a fix or anyone presenting a working around.
Here are the config options
$pdfExportConfig = [
'showHeader' => true,
'showPageSummary' => true,
'showFooter' => true,
'showCaption' => true,
'filename' => 'Item Configuration',
'alertMsg' => 'The PDF export file will be generated for download.',
'options' => ['title' => 'IMD','subject' => 'Item Configuration'],
'mime' => 'application/pdf',
'config' => [
'mode' => 'c',
'format' => 'LETTER-L',
'orientation' => 'L', // set orientation to landscape
'destination' => 'D',
'methods' => [
'SetHeader' => [
['odd' => $pdfHeader, 'even' => '']
],
'SetFooter' => [
['odd' => $pdfFooter, 'even' => '']
],
],
],
];
Here is a snippet of the view
<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => $gridColumns,
'toolbar' => [
ExportMenu::widget([
'dataProvider' => $dataProvider,
'columns' => $gridColumns,
'filename' => 'Item Configuration Export',
'fontAwesome' => true,
'dropdownOptions' => [
'label' => 'Export',
'class' => 'btn btn-outline-secondary',
],
'columnSelectorOptions' => [
'label' => 'Columns',
'class' => 'btn btn-outline-secondary'
],
'columnSelectorMenuOptions' => ['class' => 'dropdown-menu dropdown-menu-right'],
'showColumnSelector' => true,
'exportConfig' => [
ExportMenu::FORMAT_PDF => $pdfExportConfig,
ExportMenu::FORMAT_HTML => false, // Disable Excel export
ExportMenu::FORMAT_TEXT => false, // Disable CSV export
],
]),
'{toggleData}',
],
'bordered' => true,
'striped' => true,
'condensed' => true,
'responsive' => true,
'hover' => true,
'showPageSummary' => false,
'panel' => [
'type' => GridView::TYPE_PRIMARY,
],
]);
?>