Add Pdf-viewer endpoint

This commit is contained in:
Djery-Tom 2022-02-16 14:12:27 +01:00
parent 965160d1cc
commit 9da0666c05
3 changed files with 46 additions and 0 deletions

View File

@ -0,0 +1,18 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class HelperController extends Controller
{
public function pdfView(Request $request)
{
$this->validate($request, [
'url' => 'required|string'
]);
$url = $request->input('url');
return view('pdf-viewer', compact('url'));
}
}

View File

@ -0,0 +1,27 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<title>PDF Viewer</title>
<style type="text/css">
body {
margin: 0; /* Reset default margin */
padding: 0;
overflow: hidden
}
iframe {
display: block; /* iframes are inline by default */
/*background: #000;*/
border: none; /* Reset default border */
height: 100vh; /* Viewport-relative units */
width: 100vw;
}
</style>
</head>
<body>
<iframe src="{{$url}}#toolbar=0"></iframe>
{{--<object data="{{$url}}" type="application/pdf">--}}
{{-- <div>No online PDF viewer installed</div>--}}
{{--</object>--}}
</body>
</html>

View File

@ -55,6 +55,7 @@ $router->group(['prefix' => '', 'middleware' => 'auth'], function () use ($route
$router->get('invoices', 'InvoiceController@getInvoices');
$router->get('generate-invoice', 'InvoiceController@generateInvoice');
$router->get('pdf-viewer', 'HelperController@pdfView');
$router->get('authorizations-care-requests', 'AuthorizationCareRequestController@getAll');
$router->post('authorizations-care-requests', 'AuthorizationCareRequestController@store');