Installation
composer require setasign/fpdf setasign/fpdi-fpdf

Controller

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use PDF;
use DB;
use setasign\Fpdi\Fpdi;
use setasign\FpdiProtection\FpdiProtection;

class Mypdf_controller extends Controller

{

public function index()
{
// initiate FPDI
$files = ['../samplepdf/pdf1.pdf', '../samplepdf/pdf2.pdf'];
$pdf = new FpdiProtection();
foreach ($files as $file) {
$pageCount = $pdf->setSourceFile($file);
for ($i = 0; $i < $pageCount; $i++) {
$tpl = $pdf->importPage($i + 1);
$pdf->addPage();
$pdf->useTemplate($tpl);
} } $pdf->SetFont('Helvetica');
$pdf->SetFontSize('20'); // set font size
$pdf->SetXY(10, 78);//set the position of the box
$pdf->Cell(0, 10, 'Manoj kumar', 0, 0, 'C'); // add the text, align to Center of cell
$pdf->SetFontSize('20');
$pdf->SetXY(35, 90);
$pdf->Cell(120, 10, '09', 0, 0, 'C');
$pdf->SetFontSize('20');
$pdf->SetXY(70,90);
$pdf->Cell(110, 10,'12', 0, 0, 'C');
$pdf->SetXY(90,90);
$pdf->Cell(130, 10, '1992', 0, 0, 'C');
$pdf->SetFontSize('10');
$pdf->SetXY(120,105);
$pdf->Cell(50, 10, 'Election Commission of India', 0, 0, 'L');
$pdf->SetProtection(array('print','modify'),"123123","1111",2);
$pdf->Output();
}
}

Update Composer
composer dump-autoload

Inside Composer File
"require": {
"php": "^7.2",
"barryvdh/laravel-dompdf": "^0.8.5",
"fideloper/proxy": "^4.0",
"laravel/framework": "^6.0",
"laravel/tinker": "^1.0",
"laravelcollective/html": "6.0",
"setasign/fpdf": "^1.8",
"setasign/fpdi-fpdf": "^2.2",
"setasign/fpdi-protection": "^2.0"
},

Route
Route::get('/getpdf','Mypdf_controller@index');

Install FPDI Protection
composer require setasign/fpdi-protection