Search code examples
javascriptangularjspdfui-gridpdfmake

UI-Grid exporter - exporting two separate headers


Within AngularJS using pdfmake, I was able to export a header as a pdf.
Using exporterPdfHeader.

Here is the code:

$scope.gridOptions.exporterPdfHeader = {

        margin: [30, 5, 30, 10],

        table: {    
            widths: [ '*', '*', '*' ],

            body: [

              [ 'Region: ' + $scope.region, 'Group: ' + $scope.group, 'MC: ' + $scope.mc /*, 'The last one'*/ ],
              [ 'District #: ' + $scope.district, 'Route #: ' + $scope.route, 'Week Ending Date: ' + $scope.weekEndDate, /*, 'Value 4' */],    


            ]


          }

    };  

Now what I want to do is export ANOTHER header with an image inside of it. I cannot do both within this one header. Is there a way I can exporter another separate header? Or create the image inside this header as a separate row? Maybe creating another gridOptions? (gridOptions2). Any assistance would be a great help.


Solution

  • Within columns I was able to create different headers when you export a ui-grid.

    $scope.gridOptions.exporterPdfHeader = {        
                columns: [
                    {           
                    margin: [206, 0, 0, 0],
    
                    image: //long url,
                    width: 200,
                    height: 58,                 
                    },
                    {
                    margin: [ -160, 60, 33, 0 ],
    
                    table: {                        
                        widths: [ '*', '*', '*' ],
    
                        body: [
    
                          [ ],   
                        ]           
    
                      }
    
                    }
                 ]               
        };