title: How to generate PDF in laravel using laravel-dompdf library
body: <p>I'm trying to generate pdf using laravel-dompdf library. I had downloaded the package through composer.</p>
  
  <pre><code>composer require barryvdh/laravel-dompdf
  </code></pre>
  
  <p>I had updated my config >> app.php </p>
  
  <pre><code>'providers' =&gt; [
      ....
      Barryvdh\DomPDF\ServiceProvider::class,
  ],
  'aliases' =&gt; [
      ....
      'PDF' =&gt; Barryvdh\DomPDF\Facade::class,
  ],
  </code></pre>
  
  <p>I included PDF class in my controller</p>
  
  <pre><code>use PDF;
  </code></pre>
  
  <p>My controller <strong>HomeController.php</strong> is</p>
  
  <pre><code>&lt;?php
  
  namespace App\Http\Controllers;
  use PDF;
  use Illuminate\Http\Request;
  
  class HomeController extends Controller
  {
      public function index(){
          $pdf = PDF::loadView('welcome');
          return $pdf-&gt;download('invoice.pdf');
      }
  }
  </code></pre>
  
  <p>But when I call this method it shows the following error</p>
  
  <blockquote>
    <p>"fopen(C:\Users\asus\Desktop\Laravel\PDFGenerator\storage\fonts/\b4947bfc07f9f11b363f4d7446cd3e99.ufm):
    failed to open stream: No such file or directory"</p>
  </blockquote>
  
  <p>I had also added the following to my bootstrap/app.php</p>
  
  <pre><code>$app-&gt;register(\Barryvdh\DomPDF\ServiceProvider::class);
  $app-&gt;configure('dompdf');
  </code></pre>
  
  <p>There is no dompdf.php is generated in my config directory. I had tried </p>
  
  <pre><code>php artisan vendor:publish --provider="Barryvdh\DomPDF\ServiceProvider"
  </code></pre>
  
  <p>But it shows the following error</p>
  
  <p>PHP Fatal error:  Uncaught ReflectionException: Class config does not exist in </p>
  
  <blockquote>
    <p>C:\Users\asus\Desktop\Laravel\PDFGenerator\vendor\laravel\framework\src\Illuminate\Container\Container.php:767
    Stack trace:
    C:\Users\asus\Desktop\Laravel\PDFGenerator\vendor\laravel\framework\src\Illuminate\Container\Container.php(767):
    ReflectionClass->__construct('config')
    C:\Users\asus\Desktop\Laravel\PDFGenerator\vendor\laravel\framework\src\Illuminate\Container\Container.php(646):
    Illuminate\Container\Container->build('config')
    C:\Users\asus\Desktop\Laravel\PDFGenerator\vendor\laravel\framework\src\Illuminate\Container\Container.php(601):
    Illuminate\Container\Container->resolve('config', Array)
    C:\Users\asus\Desktop\Laravel\PDFGenerator\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(740):
    Illuminate\Container\Container->make('config', Array)
    C:\Users\asus\Desktop\Laravel\PDFGenerator\vendor\laravel\framework\src\Illuminate\Container\Container.php(1210):
    Illuminate\Foundation\Application->make('config') C:\U in
    C:\Users\asus\Desktop\Laravel\PDFGenerator\vendor\laravel\framework\src\Illuminate\Container\Container.php
    on line 767</p>
  </blockquote>