Zachary Palmer

Zachary Palmer


How to create and download pdf in Laravel 5.8?


What is GEEK

Buddha Community

Dylan Iqbal


In this example, i would like to share with you how to generate pdf file from view or html or blade using dompdf library in laravel 5.8. we can easily create pdf file for invoice, report, data etc and also can give for download in laravel 5.8.

As you know, few days ago laravel 5.8 released. so i plan to add tutorial for creating pdf file with laravel 5.8.

PDF is one of basic requirement when you are working with erp level project or e commerce website. we may need to create pdf file for report or invoice etc. So, here i will give you very simple example for create pdf file with laravel.

You need to just follow bellow step to create pdf file and also can download. So let’s do bellow steps.

Step 1: Install Laravel 5.8

I am going to explain step by step from scratch so, we need to get fresh Laravel 5.8 application using bellow command, So open your terminal OR command prompt and run bellow command:

composer create-project --prefer-dist laravel/laravel blog

Step 2: Install laravel-dompdf Package

first of all we will install barryvdh/laravel-dompdf composer package by following composer command in your laravel 5.8 application.

composer require lynx39/lara-pdf-merger

After successfully install package, open config/app.php file and add service provider and alias.

'providers' => [





'aliases' => [


	'PdfMerger' => LynX39\LaraPdfMerger\Facades\PdfMerger::class,


Step 3: Add Route

In this is step we need to create routes for items listing. so open your “routes/web.php” file and add following route.



Step 4: Create Controller

Here,we require to create new controller HomeController that will manage generatePDF method of route. So let’s put bellow code.



namespace App\Http\Controllers;


use Illuminate\Http\Request;

use PDF;


class HomeController extends Controller



     * Display a listing of the resource.


     * @return \Illuminate\Http\Response


    public function generatePDF()


        $data = ['title' => 'Welcome to'];

        $pdf = PDF::loadView('myPDF', $data);


        return $pdf->download('itsolutionstuff.pdf');



Step 5: Create View File

In Last step, let’s create myPDF.blade.php(resources/views/myPDF.blade.php) for layout of pdf file and put following code:


<!DOCTYPE html>






	<h1>Welcome to - {{ $title }}</h1>

	<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod

	tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,

	quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo

	consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse

	cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non

	proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>



Now we are ready to run this example and check it…

I hope it can help you…

Learn More

PHP with Laravel for beginners - Become a Master in Laravel

Projects in Laravel: Learn Laravel Building 10 Projects

Laravel for RESTful: Build Your RESTful API with Laravel

Laravel v5.8.4 released

Laravel 5.8 Tutorial for Beginners

Build a CMS with Laravel and Vue

What’s new in Laravel 5.8

Build a Basic CRUD App with Laravel and React

Laravel 8 PDF Generate Example

Today, we will see Laravel 8 PDF Generate Example.

For generating PDF file we will use Laravel-dompdf package, it is create pdf file and also provide to download file functionalities it is very easy to generate pdf in laravel 8, i will give you example in very simple way to generate pdf file and download in your system.

So, Let’s start and see how to generate pdf in laravel 8.

Laravel 8 PDF Generate Example

Read Also : Send Mail Example In Laravel 8

Read Also : How To Generate QRcode In Laravel

Read Also : How To Generate Barcode In Laravel

#laravel 8 pdf generate example #laravel 8 #pdf generate #generate pdf in laravel 8 #laravel-dompdf package #how to generate pdf in laravel 8

I am Developer


Laravel 8 Tutorial for Beginners

Hello everyone! I just updated this tutorial for Laravel 8. In this tutorial, we’ll go through the basics of the Laravel framework by building a simple blogging system. Note that this tutorial is only for beginners who are interested in web development but don’t know where to start. Check it out if you are interested: Laravel Tutorial For Beginners

Laravel is a very powerful framework that follows the MVC structure. It is designed for web developers who need a simple, elegant yet powerful toolkit to build a fully-featured website.

Recommended:-Laravel Try Catch

#laravel 8 tutorial #laravel 8 tutorial crud #laravel 8 tutorial point #laravel 8 auth tutorial #laravel 8 project example #laravel 8 tutorial for beginners

I am Developer


Laravel 8 New Features | Release Notes - Tuts Make

In this post, i will show you what’s new in laravel 8 version.

#What’s new in Laravel 8?

  • 1 - Change Path Of Default Models Directory
  • 2 - Removed Controllers Namespace Prefix
  • 3 - Enhancements on php artisan serve
  • 4 - Enhanced Rate Limiting
  • 5 - Enhanced on Route Caching
  • 6 - Update on Pagination Design
  • 8 - Dynamic Blade Componenets
  • 7 - Update Syntax for Closure Based Event Listeners
  • 8 - Queueable Model Event Listeners
  • 9 - Maintenance mode: secret access
  • 10 - Maintenance mode: pre-rendered page
  • 11 - Queued job batching
  • 12 - Queue backoff()
  • 13 - Laravel Factory

#laravel 8 features #laravel 8 release date #laravel 8 tutorial #news - laravel 8 new features #what's new in laravel 8 #laravel 8 release notes

Waylon  Bruen

Waylon Bruen


Laravel DOM PDF - How to Generate PDF in Laravel 8 Using DOM PDF

In Laravel, you have access to third-party packages because of the composer. Using composer, you can install any package in Laravel. The composer provides the package dependencies in PHP. Here, we’ll be talking about the Laravel DOM PDF . This is an open-source package available on Github to generate the PDF. By using this package, you can easily generate the PDF in Laravel. In this post, Iwill be implementing the feature to export the content as a PDF in Laravel 8. So, PDF stands for portable document format . It helps us for providing the invoices, user manuals, eBooks, application forms, etc. So, let’s start by creating a new project in Laravel 8.


  • 1 Prerequisites
  • 2 Create New Project For Laravel DOM PDF
  • 3 Create and Configure Database
  • 4 Install Laravel DOM PDF Package
  • 5 Configure DOM PDF Package in Laravel 8
  • 6 Create Model and Migration
  • 7 Create Factory Class For User Table
  • 8 Insert Dummy Records Using Tinker
  • 9 Create a Controller For Laravel 8 DOM PDF
  • 10 Add Routes For Generating PDF
  • 11 Create Views
  • 12 Conclusion
  • 12.1 Share this:
  • 12.2 Like this:
  • 12.3 Related


To start the Laravel 8 project, you will require the following tools configured in your system.

  • PHP >= 7.3
  • MySQL (version > 5)
  • Apache/Nginx Server
  • VS Code Editor
  • Composer

#laravel 8 #laravel create pdf file #laravel pdf #laravel

Laravel 8 Create Custom Helper Function Example

Today, We will see laravel 8 create custom helper function example, as we all know laravel provides many ready mate function in their framework, but many times we need to require our own customized function to use in our project that time we need to create custom helper function, So, here i am show you custom helper function example in laravel 8.

Laravel 8 Create Custom Helper Function Example

Read Also : Cron Job Scheduling In Laravel

#laravel 8 create custom helper function example #laravel #custom helper function #how to create custom helper in laravel 8 #laravel helper functions #custom helper functions in laravel