Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

artisticre's avatar

BarryVDH Something Weird Happening

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");
        }

    }

0 likes
9 replies
bobbybouwmann's avatar

Not sure what this could be. Did you create an issue on the repository of the package?

artisticre's avatar

No I haven't. Here is an example of what I am talking about. If the data printing to this field is"

We are a Southern California based leadership development ministry serving all Lutheran
churches. We are a lay-led movement focused on preparing strong Christian leaders to go back
into their churches and communities and serve. As a self-supporting organization, we operate
independently of any synod, branch or other church body, but adhere to the core values and
teachings of the Lutheran faith.

It displays like this, printing the data 3 times. Only on the first field of the page. It doesn't do it if I print to a view.

We are a Southern California based leadership development ministry serving all Lutheran
churches. We are a lay-led movement focused on preparing strong Christian leaders to go back
into their churches and communities and serve. As a self-supporting organization, we operate
independently of any synod, branch or other church body, but adhere to the core values and
teachings of the Lutheran faith.We are a Southern California based leadership development
ministry serving all Lutheran churches. We are a lay-led movement focused on preparing strong
Christian leaders to go back into their churches and communities and serve. As a self-supporting
organization, we operate independently of any synod, branch or other church body, but adhere to
the core values and teachings of the Lutheran faith.We are a Southern California based
leadership development ministry serving all Lutheran churches. We are a lay-led movement
focused on preparing strong Christian leaders to go back into their churches and communities
and serve. As a self-supporting organization, we operate independently of any synod, branch or
other church body, but adhere to the core values and teachings of the Lutheran faith.
We are a Southern California based leadership development ministry serving all Lutheran
churches. We are a lay-led movement focused on preparing strong Christian leaders to go back
into their churches and communities and serve. As a self-supporting organization, we operate
independently of any synod, branch or other church body, but adhere to the core values and
teachings of the Lutheran faith.We are a Southern California based leadership development
ministry serving all Lutheran churches. We are a lay-led movement focused on preparing strong
Christian leaders to go back into their churches and communities and serve. As a self-supporting
organization, we operate independently of any synod, branch or other church body, but adhere to
the core values and teachings of the Lutheran faith.
Snapey's avatar

You know a table cannot span pages ?

Snapey's avatar

depends if you are expecting it to span a page break?

Why not show the relevant bits if the view? I assume you have a foreach loop?

artisticre's avatar

Here is my view and css

<style>

@media print {
      size:A4;
      .download {display:none}
    }
    @page { size:8.5in 11in; margin-left:.10px;margin-top: 1cm;margin-bottom: .5vm;margin-right:.10px; }
   
table {
  width: 100%;
  margin:0 auto;
  border-spacing:0;
  overflow:hidden;
  border:1px solid black;
} 



 tr, td {
  border: 1px solid black;
}
ol {
  list-style:number;
  font-size:1em;
}
li {
  padding-bottom:10px;
}

input[type=text],
input[type=password] {
width:100%;
display: block;
  padding: .3em 1em;
  background-color: #f2f2f2;
  font-size: 1em;
  color: #0275d8;
 
}

input {
    box-sizing: border-box;
    border: 1px solid #bdbdbd;
    margin-bottom:10px;
}
textarea {
	min-height: 10em;
	max-height: 50vh;
	width: 100%;
}


label {
  color:black;
  font-weight:bold;
  font-size:1em;

}


}



</style>

<table style="width:90%;margin:0 auto;padding:0px">
@foreach ($sponsor_print as $key => $p)

	
<tr>
   <td colspan="6" style="margin:0 auto;text-align:center"><img src="images/lclogo.jpg" width="450" height="125"></td>
</tr>

   <tr> 
   <td colspan="6" style="text-align:left;color:black;font-size:1.10em;padding:10px;">
   <h5 class="card-title font-weight-bold text-center pt-3">PLEASE FILL THE APPLICATION OUT COMPLETELY AND COMPLETE ONE APPLICATION PER APPLICANT</H5>
      <p class="lead">Carefully review the sponsor guidelines before sponsoring anyone.  Send the completed application to the registrar.
      Married couples should have the same sponsor(s).  A non-refundable donation of  for each pilgrim sponsored is requested. 
      The goal of the movement is to inspire, challenge and equip local church members for Christian action in their lives, homes, churches,
      and communities.</p>
   </td> 
   </tr>	
   
   <tr>
   <td colspan="6" cellpadding="0" style="text-align:center;font-weight:bold;font-size:1.5em;background-color:#0275d8;color:white;padding:0px;">Sponsor Information</td>
 </tr>
 <tr>
 <td colspan="6"><label>Name: </label><input type="text" value="{{$p->name ?? 'N/A'}}"></td>
 </tr>
 <tr>
 <td colspan="3"><label>Address: </label> <input type="text" value="{{$p->address ?? 'N/A'}}"></td>
 <td colspan="3"><label>Apt #: </label> <input type="text" value="{{$p->apt ?? 'N/A'}}"></td>
 </tr>

 <tr>
 <td colspan="2"><label>City: </label> <input type="text" value="{{$p->city ?? 'N/A'}}"></td>
 <td colspan="2"><label>State: </label> <input type="text" value="{{$p->state ?? 'N/A'}}"></td>
 <td colspan="2"><label>Zipcode: </label> <input type="text" value="{{$p->zipcode ?? 'N/A'}}"></td>
 </tr>

 <tr>
 <td colspan="2"><label>Email: </label> <input type="text" value="{{$p->email ?? 'N/A'}}"></td>
 <td colspan="2"><label>(H) Phone: </label> <input type="text" value="{{$p->homephone ?? 'N/A'}}"></td>
 <td colspan="2"><label>(C) Phone: </label> <input type="text" value="{{$p->cellphone ?? 'N/A'}}"></td>
 </tr>
<tr>
<td colspan="3"><label for="applicantname" class="font-weight-bold col-form-label text-md-left">{{ __('Applicant Name') }}</label>
<input type="text" value="{{ $p->applicantname }}" disabled>
</td>
<td colspan="3">
<label for="besttime" class="font-weight-bold col-form-label text-md-left">{{ __('Best Time To Call') }}</label>
<input type="text" value="{{ $p->besttime }}" disabled>
</td>
</tr>

<tr>
<td colspan="3"><label for="applicantbaptized" class="font-weight-bold col-form-label text-md-left">{{ __('Is this applicant a baptized member
  in regular attendance and/or active in ministries of a Lutheran Church?') }}</label>
<input type="text" value="{{$p->applicantbaptized ? 'Yes' : 'No'}}" disabled>
</td>
<td colspan="3">
<label for="spousediscussed" class="font-weight-bold col-form-label text-md-left">{{ __('If applicable, did you discuss Lutheran Cursillo
  with the applicant\'s spouse?') }}<br /><br /></label>
<input type="text" value="{{$p->spousediscuss ? 'Yes' : 'No'}}" disabled>
  
</td>
</tr>

<tr>
<td colspan="6">
<label for="bothspouseattend" class="font-weight-bold col-form-label text-md-left">{{ __('
  Will both be applying to attend the weekend?') }}</label>
<input type="text" value="{{$p->bothspouseattend ? 'Yes' : 'No'}}" disabled>
</td>
</tr>
<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>

<tr>
<td colspan="6">
<label for="whygoodcandidate" class="col-form-label text-md-left font-weight-bold">{{ __('Why do you think this person is a good candidate for a Cursillo weekend') }}</label>
   <input type="text" disabled value="{{ $p->whygoodcandidate ?? 'N/A' }}">
</td>
</tr>

<tr>
<td colspan="6">
<label for="applicantattitude" class="col-form-label text-md-left font-weight-bold">{{ __('
   Briefly state the applicant\'s attitude toward Lutheran Cursillo') }}</label>
   <input type="text" disabled value="{{ $p->applicantattitude ?? 'N/A' }}">
</td>
</tr>

<tr>
<td colspan="6">
<label for="leadershipexpectations" class="col-form-label text-md-left font-weight-bold">{{ __('
   With leadership in mind, what do you expect this person to gain from the Cursillo experience?') }}</label>
   <input type="text" disabled value="{{ $p->leadershipexpectations ?? 'N/A' }}">
</td>
</tr>

<tr>
<td colspan="6">
<label for="sponsorsupport" class="col-form-label text-md-left font-weight-bold">{{ __('
   How, specifically, will you support this applicant during his/her fourth day?') }}</label>
   <input type="text" disabled value="{{ $p->sponsorsupport ?? 'N/A' }}">
</td>
</tr>

<tr>
<td colspan="6">
<label for="otherinfo" class="col-form-label text-md-left font-weight-bold">{{ __('
   Other pertinent information about the applicant:') }}</label>
   <input disabled type="text" value="{{ $p->otherinfo ?? 'N/A' }}">

</td>

</tr>


<tr>
 <td colspan="2"><label>Sponsor Signature: </label> <input type="text" value="{{$p->name ?? 'N/A'}}"></td>
 <td colspan="2"><label>Sponsor Email: </label> <input type="text" value="{{$p->email ?? 'N/A'}}"></td>
 <td colspan="2"><label>Date Signed: </label> <input type="text" value="{{$p->datesigned ?? 'N/A'}}"></td>
 </tr>
 @endforeach
</table>
Snapey's avatar

how about if you move the table start and end into the foreach loop so that each sponsor is in its own table?

artisticre's avatar

Nope. I even closed the foreach and started a new for each after a page break and it still is doubling up the first field on the page. I just don't get it.

artisticre's avatar
artisticre
OP
Best Answer
Level 5

I took the data out of an input and it works. Not sure why it double up with the input but problem solved I guess

So I went from

<input type="text" disabled value="{{ $p->ifnospouseattend ?? 'N/A' }}">

to

{{ $p->sponsorsupport ?? 'N/A' }} 

Please or to participate in this conversation.