title: Specify Font Size of Gridview in yii2
body: <p>I'm printing gridview in pdf. The gridview is fine. But the cells are not filling in properly. I think if I can decrease the font a bit, the cell will be filled in properly. I've decreased the width. But the cells are being distorted.</p>
  <p>Code of Gridview -</p>
  <pre><code>&lt;?= GridView::widget([
          'dataProvider' =&gt; $dataProvider1,
          //'filterModel' =&gt; $searchModel,
          'layout'=&gt;&quot;{items}&quot;,
          'columns' =&gt; [
              ['class' =&gt; 'yii\grid\SerialColumn'],
              'hsncode',
              [
                  'label' =&gt; 'Productname',
                  'attribute' =&gt;'productname',
                  'headerOptions' =&gt; ['style' =&gt; 'width:20%'],
                  //'contentOptions' =&gt; ['class' =&gt; 'col-lg-1'],
                  //'format'=&gt;['decimal',2]
              ],
              'batchno',
              //'expdate',
              [
                  'attribute'=&gt;'expdate',
                  'format'=&gt;['DateTime','php:m-y'],
                  'headerOptions' =&gt; ['style' =&gt; 'width:6%'],
              ],
              'mrp',
              'rate',
  
              'qty',
              'free',           
              'discount',
              [
                  'label' =&gt; 'Value',
                  'attribute' =&gt;'value',
                  //'contentOptions' =&gt; ['class' =&gt; 'col-lg-1'],
                  'format'=&gt;['decimal',2]
              ],
              [
                  'label' =&gt; 'GST%',
                  'attribute' =&gt;'gstpercent',
                  //'headerOptions' =&gt; ['style' =&gt; 'width:6%'],
                  //'contentOptions' =&gt; ['class' =&gt; 'col-lg-1'],
                  'format'=&gt;['decimal',0]
              ],
  
  
              [
                  'label' =&gt; 'Total',
                  'attribute' =&gt;'totalamount',
                  'headerOptions' =&gt; ['style' =&gt; 'width:9%'],
                  //'contentOptions' =&gt; ['class' =&gt; 'col-lg-1'],
                  'format'=&gt;['decimal',2]
              ],
          ],
          ]); ?&gt;
  </code></pre>
  <p>Gridview looks like -
  <a href="https://i.stack.imgur.com/QUjJD.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QUjJD.jpg" alt="enter image description here" /></a></p>
  <p>Please let me know how to specify the font in gridview.</p>