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

Download & Stream Not Working After Adding Dynamic Variables #524

Open
kinger251285 opened this issue Dec 29, 2023 · 1 comment
Open

Download & Stream Not Working After Adding Dynamic Variables #524

kinger251285 opened this issue Dec 29, 2023 · 1 comment

Comments

@kinger251285
Copy link

Laravel 10.10
Inertia
Jetstream
Vue
Lavravel-Snappy 1.0
Local - profburial/wkhtmltopdf-binaries-osx": "0.12.1"

I am getting the below screenshot when trying to crate a PDF after adding in dynamic variables. This appears in a popup:

image

If i try stream rather than download i get a 500 error.

If i dd($pdf); then all the html output looks fine although file is null (not sure if this is correct).

viewPDF Method:

public function viewPDF($id)
    {

        $Application = AccountApplications::where('id', $id)->first();        

        $pdf = PDF::loadView('pdf.accountApplication', [ 'Application' => $Application]);        

        return $pdf->download($Application->company_name.'.pdf');
        
    }

pdf.accoutnApplication.blade.php

@extends('pdf.pdfLayout')
@section('content')
        <table>		  
		  <tbody>
		    <tr>
		      <td >COMPANY <span class="text-red">FULL</span> TRADING NAME AND ADDRESS.
				PLEASE ALSO INCLUDE…. PROPRIETOR’S FULL NAME
				AND ADDRESS.
			  </td>
		      <td>	Company Name: {{ $Application->company_name }}<br>
					Proprietor Name: {{ $Application->proprietor_name }}<br>
					Street Address: {{ $Application->street_address }}<br>
					Address Line 2: {{ $Application->address_line_2 }}<br>
					Town: {{ $Application->city }}<br>
					County: {{ $Application->region }}<br>
					Postcode: {{ $Application->postcode }}<br>
					
			</td>
		      <td></td>
		    </tr>
		    <tr>
		      <td>ALL COMPANY CONTACT TELEPHONE NUMBERS<br><br>


				  EMAIL ADDRESS</td>
		      <td>	Phone: {{ $Application->company_phone }}<br><br>
		      		Email: {{ $Application->company_email }}<br>
		      </td>
		      <td></td>
		    </tr>
		    <tr>
		      <td>COMPANY REGISTRATION NUMBER</td>
		      <td>{{ $Application->company_registration_no }}<br></td>
		      <td></td>
		    </tr>
		    <tr>
		      <td>SUBJECT TO ACCEPTANCE, AMOUNT OF CREDIT REQUIRED?</td>
		      <td>{{ $Application->credit_required }}<br></td>
		      <td></td>
		    </tr>
		    <tr>
		      <td>REFERENCES X2</td>
		      <td>	Reference 1: <br><br>
					Name: {{ $Application->ref1_contact_name }}<br>
					Company: {{ $Application->ref1_company_name }}<br>
					Street: {{ $Application->ref1_street }}<br>
					Town: {{ $Application->ref1_city }}<br>
					County: {{ $Application->ref1_region }}<br>
					Postcode: {{ $Application->ref1_postcode }}<br>
					Email: {{ $Application->ref1_email }}<br>
					Phone: {{ $Application->ref1_phone }}<br><br>
			 </td>
		      <td>	Reference 1: <br><br>
					Name: {{ $Application->ref1_contact_name }}<br>
					Company: {{ $Application->ref1_company_name }}<br>
					Street: {{ $Application->ref1_street }}<br>
					Town: {{ $Application->ref1_city }}<br>
					County: {{ $Application->ref1_region }}<br>
					Postcode: {{ $Application->ref1_postcode }}<br>
					Email: {{ $Application->ref1_email }}<br>
					Phone: {{ $Application->ref1_phone }}<br><br>
			 </td>
		    </tr>
		    <tr>
		      <td>BANK DETAILS FOR B.A.C.S SET UP</td>
		      <td>Company<br><br>


ACC           12345678<br>
SORT         12-34-56</td>
		      <td>E-MAIL CONTACT
 [email protected]<br><br>

for bacs confirmation</td>
		    </tr>
		  </tbody>
		</table>		
@endsection
@kinger251285
Copy link
Author

Further to this if i do:

$pdf = PDF::loadView('pdf.accountApplication', ['Application' => $Application])->save($Application->company_name.'.pdf');

It saves the file to the public drive and has created the pdf perfectly.

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

1 participant