Sharath
Sharath

Reputation: 2428

Class 'Inline\PDF\PDF' not found in laravel using wemersonjanuario/laravelpdf package

I am trying to use this package -> http://packalyst.com/packages/package/wemersonjanuario/laravelpdf

I have installed and configured as per the website and also I had used this package couple of times which worked following the same procedure.

But now its giving the error Class 'Inline\PDF\PDF' not found

Not sure whats the mistake.

Can someone please help me sort this issue.

Below is the sample code

Composer.json file

"h4cc/wkhtmltopdf-i386": "0.12.3",
"wemersonjanuario/laravelpdf": "1.0.*"

app.php file

'providers' => [
        //  other providers
        Inline\LaravelPDF\PDFServiceProvider::class
    ],

'aliases' => [
        // other aliases
        'PDF' => Inline\LaravelPDF\PDFFacade::class,

    ],

In config/laravelpdf.php file

<?php
return [
    'executable' => base_path().'/vendor/h4cc/wkhtmltopdf-i386/bin/wkhtmltopdf-i386'
];

PHP Pdf code

use Inline\LaravelPDF\PDFFacade as PDF;

class SummaryHelper
{
   public function getReport($date)
   {
      // Some code
      $data = [ ];   // some data in it

      $pdf_obj = PDF::loadView('vendor/daily-report', $data);
   }
}

Github issue link

config/app.php file

Upvotes: 0

Views: 582

Answers (2)

Wemerson Januario
Wemerson Januario

Reputation: 139

Sorry for this.

I have changed the namespace to Novanti instead of Inline.

Please switch to 1.1.* version and change alias and provider namespaces to Novanti.

I have also updated the README.md to better document this.

Let me know if this works.

Thank you for reporting.

Upvotes: 0

Alexey Mezenin
Alexey Mezenin

Reputation: 163938

I've installed the package and got the same error. The thing is it's just a fork from another package and the guy didn't updated readme.md for correct namespaces. What you need to do it to change Inline to Novanti in config/app.php. Both for service provider and facade.

Then add this to the class where you want to use PDF facade:

use PDF;

Or just use full namespace:

$pdf_obj = \PDF::loadView('vendor/daily-report', $data);

Upvotes: 2

Related Questions