Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I generate the pdf without storing it in server. #15

Open
Ryurial opened this issue Oct 1, 2018 · 1 comment
Open

How can I generate the pdf without storing it in server. #15

Ryurial opened this issue Oct 1, 2018 · 1 comment

Comments

@Ryurial
Copy link

Ryurial commented Oct 1, 2018

Let the person choose to download the pdf or not. The example given is saving the generated pdf to the $output path.

@savankaneriya
Copy link

this is the way you can patch this.
$report = '/path/to/report.pdf'; if (! file_exists ($report)) { abort (404); } $filename = $this->getFileName($report_source->file).'pdf'; // if it was generated I get the contents $file = file_get_contents ($report); // delete the generated file, because we will send the content to the browser unlink ($report); // return the content to the browser that will open the PDF return Response::make($file, 200, [ 'Content-Type' => 'application/pdf', 'Content-Disposition' => 'inline; filename="'.$filename.'"' ]);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants