0

I am trying to set the Header and Footer for the exported PDF file.
 The PDF file is created correctly will all the data, but the Header and Footer do not appear.
 Below is my code:
 echo DynaGrid::widget([
    ‘columns’ => $gridColumn,
    ‘storage’ => DynaGrid::TYPE_COOKIE,
    'gridOptions' => [
  'dataProvider' => $dataProvider,
  'filterModel' => $searchModel,
  'floatHeader' => false,
  'resizableColumns' => true,
  'persistResize' => true,
  'hover' => true,
  'pjax'=>true,
  'responsiveWrap'=>false,
     'panel' => [
      'type' => GridView::TYPE_PRIMARY,
      'heading' => '<span class="glyphicon glyphicon-book"></span>  ' . Html::encode($this->title),
             'before' => Html::a('<i class="glyphicon glyphicon-plus"></i> Add', ['create'], [
          'class' => 'btn btn-success', Yii::$app->user->can('approval-create') ? '' : 'style' => 'display:none'
      ]),
  ],
   'export' => [
      'label' => 'Page',
      'options' => ['title' => 'Export Page'],
  ],
   'exportConfig' => [
      GridView::HTML => ['filename' => 'Approval - List'],
      GridView::CSV => ['filename' => 'Approval - List'],
      GridView::TEXT => ['filename' => 'Approval - List'],
             GridView::PDF => [
          'filename' => 'Approval - List 1', 
                     'config' => [
              'methods' => [
                  'SetHeader' => ['|Approval - List|'],
                  'SetFooter' => ['Printed ' . date("F d\, Y h:i:s A") . '||Page {PAGENO}'],
              ],
          ], 
      ],
             GridView::EXCEL => ['filename' => 'Approval - List'],
  ], 
     'toolbar' =>  [
                                             ['content' =>
          Html::a('<i class="glyphicon glyphicon glyphicon-refresh"></i>', ['index'], ['data-pjax'=>0, 'class' => 'btn btn-outline-success', 'title'=>'Reset Grid'])
      ],
         ['content' => '{toggleData}{dynagridFilter}{dynagridSort}{dynagrid}'],
             '{export}',
                                               ExportMenu::widget([
          'dataProvider' => $dataProvider,
          'columns' => $gridColumn,
          'target' => ExportMenu::TARGET_BLANK,
                                                                                                     'filename' => 'Approval - List',
          //'fontAwesome' => false,
                 'exportConfig' => [
              ExportMenu::FORMAT_PDF => [
                                                                                     'pdfConfig' => [
                      'methods' => [
                          'SetHeader' => ['|Approval - List|'],
                          'SetFooter' => ['Printed ' . date("F d\, Y h:i:s A") . '||Page {PAGENO}'],
                      ],
                  ],
              ],
          ],
                                                                                                                           'dropdownOptions' => [
              'label' => 'Full',
              'class' => 'btn btn-default',
                             'itemsBefore' => [
                  '<li class="dropdown-header">Export All Data</li>',
              ],
          ],
      ]),
  ],
   'pager' => [
      'firstPageLabel' => 'First', 
      'lastPageLabel' => 'Last',     
  ],
],
 'options' => ['id' => 'dynagrid-approval-index'],

Dynagrid Export all data – I am trying to set the Header and Footer for the exported PDF file.
Lloyd Pedvis Asked question May 7, 2023