artisticre
4 months ago
547
9
Laravel

BarryVDH Something Weird Happening

Posted 4 months ago by artisticre

I am not sure how explain this. I have everything work great. But when the pdf has a second or third page, it triple displays the first column. For instance, I have this table row below. It usually prints at the top of the second page. The data is listed three times in the table row. It happens again in another one when there is a third page printed. I am baffled on how to fix this. If there is anything else I can show to try to fix this, I will add it here too

<tr>
<td colspan="6">
<label for="ifnospouseattend" class="col-form-label text-md-left font-weight-bold">{{ __('If Answered No, please explain briefly:') }}</label>
<input type="text" disabled value="{{ $p->ifnospouseattend ?? 'N/A' }}">
</td>
</tr>

PDF Print Controller

 public function sponsorpdfview(Request $request,$id)
    {
        $sponsor_print = DB::table('users')
        ->join('profile', 'profile.user_id', '=', 'users.id')
        ->join('sponsorapp', 'sponsorapp.user_id', '=' ,'profile.user_id')
        ->select(
           'users.name',
           'profile.address',
           'profile.apt',
           'profile.city',
           'profile.state',
           'profile.zipcode',
           'users.email',
           'profile.homephone',
           'profile.cellphone',
           'sponsorapp.applicantname',
           'sponsorapp.besttime',
           'sponsorapp.applicantbaptized',
           'sponsorapp.spousediscuss',
           'sponsorapp.bothspouseattend',
           'sponsorapp.ifnospouseattend',
           'sponsorapp.whygoodcandidate',
           'sponsorapp.applicantattitude',
           'sponsorapp.leadershipexpectations',
           'sponsorapp.sponsorsupport',
           'sponsorapp.otherinfo'

            
            )
            ->where('sponsorapp.id', '=', $id)
            ->get();


    
            foreach($sponsor_print as $item){
                $item->homephone = $this->formatPhoneNumber($item->homephone);
                $item->cellphone = $this->formatPhoneNumber($item->cellphone);
            }
        if($request->has('download')){
            $name = $request->query('name', 'Sponsor');
            $pdf = PDF::loadView('registrar.sponsorpdfview', ['sponsor_print' => $sponsor_print, 'pdf' => true]);
            return $pdf->download("{$name} - SponsorApplication.pdf");
        }

    }

Please sign in or create an account to participate in this conversation.