title: How to set css at time of PDF creation in yii2?
body: <p><strong>Pdf fuction*</strong>
   This function is call from ajax after getting data from this function it's call anothe file here I am display data which is coming from data base.That file all css part in style tag using then as it is style tag prind in pdf as a text and if this all css file include in css folder then pdf is not create in proper format</p>
  
  <pre><code>public function actionInvoicespacking(){ 
      $pdf = Yii::$app-&gt;pdf;
      $modelShipment = Shipment::find()-&gt;orderBy('ship_id DESC')-&gt;one();
      if(count($modelShipment) == 0) {
  
        $shipid= 1;
      } else 
      {
       $shipid= $modelShipment-&gt;ship_id;
  
     }
     $htmlContent = file_get_contents('http://localhost/shepherdlogistics_v1.0/backend/views/shipment/invoicespackingdata.php');
     $pdf-&gt;content = $htmlContent;
     return $pdf-&gt;render();
  
   }
  </code></pre>
  
  <p><strong>invoicespackingdata.php</strong></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  
  &lt;head&gt;
      &lt;title&gt;Invoice&lt;/title&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
      &lt;link rel="stylesheet" href="css/bootstrap.fontawesome.min.css"&gt;
      &lt;link rel="stylesheet" href="css/stylepdf.css"&gt;
      &lt;script src="js/jquery.min.js"&gt;&lt;/script&gt;
      &lt;script src="js/bootstrap.min.js"&gt;&lt;/script&gt;
      &lt;style type="text/css"&gt;
      body {
          font-size: 18px;
          font-family: cambria;
      }
  
      .nopadd {
          padding: 0px;
      }
      &lt;/style&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
      &lt;div class="container"&gt;
          &lt;br&gt;
          &lt;br&gt;
          &lt;div class=""&gt;
              &lt;div class="col-lg-2 nopadd"&gt;
                  &lt;img src="logopdf.png" alt="logo" width="100%"&gt;
              &lt;/div&gt;
              &lt;div class="col-lg-10"&gt;
                  &lt;h1 style="font-size: 55px;font-weight: bold; padding: 23px 0px;"&gt;
                  SHEPHERD LOGISTICS CO. W.L.L.&lt;/h1&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>