DEV Community

slarkjm0803
slarkjm0803

Posted on

pdf problem with laravel

I can't save the pdf with laravel.
How can I save the pdf file on local storage?

here is my code.

$pdf = App::make('snappy.pdf.wrapper');
$pdf->setPaper('A4');
$pdf->setOption('margin-bottom', '1cm');
$pdf->setOption('margin-top', '2cm');
$orientation = 'portrait';
$pdf->setOption('margin-right', '1cm');
$pdf->setOption('margin-left', '1cm');
$pdf->setOption('enable-javascript', true);
$pdf->setOption('enable-smart-shrinking', true);
$pdf->setOption('no-stop-slow-scripts', true);
$fileName = 'Test.pdf';
$pdf->setOrientation($orientation);
$pdf->loadView('reports.track');
$pdf->save(storage_path($fileName));

I am getting this error.

"The exit status code '1' says something went wrong: stderr: "The system cannot find the path specified. " stdout: ""

please help me!
Thanks

Top comments (2)

Collapse
 
cverster profile image
Cornel Verster
Collapse
 
slarkjm0803 profile image
slarkjm0803

yes, but how can I know that?
:)