Demo - Export to PDF

HTML

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdn.grapecity.com/wijmo/5.latest/styles/wijmo.min.css">
<script src="https://cdn.grapecity.com/wijmo/5.latest/controls/wijmo.min.js"></script>
<script src="https://cdn.grapecity.com/wijmo/5.latest/controls/wijmo.grid.min.js"></script>
<script src="https://cdn.grapecity.com/wijmo/5.latest/controls/wijmo.input.min.js"></script>
<script src="https://cdn.grapecity.com/wijmo/5.latest/controls/wijmo.grid.filter.min.js"></script>
<script src="https://cdn.grapecity.com/wijmo/5.latest/controls/wijmo.pdf.min.js"></script>
<script src="https://cdn.grapecity.com/wijmo/5.latest/controls/wijmo.grid.pdf.min.js"></script>
<div class="container">

  <h1>
    Export to PDF
  </h1>
    
  <button id="btnExport" class="btn btn-default">
    Export to PDF
  </button>
  
  <div id="theGrid"></div>
  
</div>

CSS

.wj-flexgrid {
  max-height: 250px;
  margin: 12px 0;
}

.wj-cell.wj-header{
  text-align: left;
}

body {
  margin-bottom: 20px;
}

JavaScript

onload = function() {

  // create some random data
  var countries = 'US,Germany,UK,Japan,Italy,Greece'.split(',');
  var data = [];
  for (var i = 0; i < 200; i++) {
    data.push({
    	id: i,
      country: countries[i % countries.length],
      sales: Math.random() * 10000,
      expenses: Math.random() * 5000
    });
  }

  // show the data in a grid
  var theGrid = new wijmo.grid.FlexGrid('#theGrid', {
  	autoGenerateColumns: false,
    columns: [
    	{ binding: 'id', header: 'ID', width: 60 },
    	{ binding: 'country', header: 'Country', width: '2*'},
    	{ binding: 'sales', header: 'Sales', width: '*', format: 'n2'},
    	{ binding: 'expenses', header: 'Expenses', width: '*', format: 'n2'}
    ],
    itemsSource: data
  });
  
  // add a filter to show that it works while exporting
  var f = new wijmo.grid.filter.FlexGridFilter(theGrid);
  
	// export grid to PDF
  document.getElementById('btnExport').addEventListener('click', function() {
		wijmo.grid.pdf.FlexGridPdfConverter.export(theGrid, 'LearnWijmo.pdf', {
    	maxPages: 10,
      scaleMode: wijmo.grid.pdf.ScaleMode.PageWidth,
      documentOptions: {
      	compress: true,
        header: { declarative: { text: '\t&[Page] of &[Pages]' } },
        footer: { declarative: { text: '\t&[Page] of &[Pages]' } },
        info: { author: 'C1', title: 'Learn Wijmo' }
			},
      customCellContent: false, // set to true to get custom cell content
    	styles: {
				cellStyle: { backgroundColor: '#ffffff', borderColor: '#c6c6c6' },
	    	altCellStyle: { backgroundColor: '#f9f9f9' },
	    	groupCellStyle: { backgroundColor: '#dddddd' },
    		headerCellStyle: { 
        	backgroundColor: '#eaeaea',
          textAlign: 'left' //not required if customCellContent is set to true
        }
			}
		});
	});
}