2017-10-15 10 views
1

임, 그것은로드, 절대 PDF를 생성하고 저장 폴더 및 데이터베이스에 저장, 문제는 시도 dompf 를 사용 laravel github에서 샘플 코드를 사용하면 "test"라고 표시되지만보기를로드하려고하면 영원히 걸립니다. 이것은 내가Dompf 부하 영원히 내가 <strong>PDF</strong>을 생성 할 때 때 4.2

$pdf = PDF::loadView('emails.myView',$myData); 
return $pdf->stream(); 

나는 downloadsave 방법을 사용하여 시도를 사용하고 코드 만 넣은 사람은 아니다 업무와 영원히 페이지로드하지만 PDF 파일이 생성되지 않습니다.

보기는 단지 1 주 호출 $hist이있는 4 또는 6 개의 요소를 보여 주므로보기를 반환해도 문제없이 렌더링됩니다.

<style type="text/css"> 
     Bunch of css. 
</style> 

<table class="center-block"> 
    <tr> 
     <td colspan="3"> 
      <img src="{{ asset('images/boletin/btn_cabeza.jpg') }}" class="img-responsive center-block"> 
     </td> 
    </tr> 
    <tr> 
     <td rowspan="4" class="aside"> 
      <a href="{{ URL::to('contacto/donaciones') }}"> 
       <img src="{{ asset('images/boletin/btn_dona.jpg') }}" class="img-responsive center-block" > 
      </a> 

      <div class="social-container"> 
       <h3>Siguenos en:</h3> 
       <hr> 
       <ul> 
        <li><a href="https://twitter.com/fundaepekeina"><i class="fa fa-twitter"></i></a></li> 
        <li><a href="http://fundaepekeina.org"><i class="fa fa-instagram"></i></a></li> 
        <li><a href="https://www.facebook.com/funda.epekeina"><i class="fa fa-facebook"></i></a></li> 
        <li><a href="https://www.youtube.com/user/fundaepekeina"><i class="fa fa-youtube-play"></i></a></li> 
       </ul> 
      </div> 
      <h2 class="text-blue">Historias Epékeinas</h2> 
      <br> 
      @if(count($hist->imagenes) > 0) 
       <img src="{{ asset('images/news/'.$hist->imagenes->first()->image) }}" class="img-responsive img-boletin" alt="{{ $hist->titles->first()->text }}"> 
      @endif 
      <div class="bg-green padding-20"> 
       <h2 class="boletin-title"> 
        {{ $hist->titles->first()->text }} 
        @if(!is_null($hist->subtitle)) 
        {{ $hist->subtitle->titles->first()->text }} 
        @endif 
       </h2> 
      </div> 
      <hr> 
      <div class="text-justify"> 
       {{ substr(strip_tags($hist->descriptions->first()->text), 0, 1600) }}[...] 
       <br> 
       <a href="{{ URL::to('quienes-somos/historias-epekeinas/'.$hist->slugs->first()->text) }}" class="pull-right">Leer más</a> 
      </div> 
     </td> 
    </tr> 
    <?php $k = 0;?> 
    @foreach($article as $a) 
     @if($k == 0 || $k%2 == 0) 
      <tr> 
     @endif 
     @if(!empty($principal)) 
      @if($a->slugs->first()->text != $principal->id) 
       <td class="news fixedHeight bg-{{ $colors[$j] }}"> 

        @if(count($a->imagenes) > 0) 
         <img src="{{ asset('images/news/'.$a->imagenes->first()->image) }}" class="img-responsive center-block img-boletin" alt="{{ $a->titles->first()->text }}"> 
        @else 
         <img src="{{ asset('images/logo.png') }}" class="img-responsive center-block img-boletin" alt="{{ $a->titles->first()->text }}"> 
        @endif 
        <h2 class="boletin-title">{{ $a->titles->first()->text }}</h2> 
        <p class="text-justify">{{ substr(strip_tags($a->descriptions->first()->text), 0, 300) }} [...]</p> 
        <a target="_blank" href="{{ URL::to('noticias/'.$a->slugs->first()->text) }}" class="btn btn-default btn-xs pull-right">Leer más</a> 
        <div class="clearfix"></div> 
       </td> 
       <?php $k++; ?> 
      @endif 
     @else 
      <td class="news fixedHeight bg-{{ $colors[$j] }}"> 
       @if(count($a->imagenes) > 0) 
        <img src="{{ asset('images/news/'.$a->imagenes->first()->image) }}" class="img-responsive center-block img-boletin" alt="{{ $a->titles->first()->text }}"> 
       @else 
        <img src="{{ asset('images/logo.png') }}" class="img-responsive center-block img-boletin" alt="{{ $a->titles->first()->text }}"> 
       @endif 
       <h2 class="boletin-title">{{ $a->titles->first()->text }}</h2> 
       <p class="text-justify">{{ substr(strip_tags($a->descriptions->first()->text), 0, 300) }} [...]</p> 
       <a target="_blank" href="{{ URL::to('noticias/'.$a->slugs->first()->text) }}" class="btn btn-default btn-xs pull-right">Leer más</a> 
       <div class="clearfix"></div> 
      </td> 
      <?php $k++; ?> 
     @endif 
     <?php $j++; ?> 
      @if($j == 4) 
      <?php $j=0; ?> 
      @endif 

     @if(($k != 0 && $k%2 == 0) || $k == count($article)) 
      </tr> 
     @endif 
    @endforeach 
    <tr> 
     <td colspan="3" class="text-center"> 
      <h3>&copy; Derechos Reservados Funda Epékeina 2016.</h3> 
     </td> 
    </tr> 
</table> 
<div class="container center-block"> 
     <div class="bg-square bg-blue"></div> 
     <div class="bg-square bg-yellow"></div> 
     <div class="bg-square bg-green"></div> 
     <div class="bg-square bg-pink"></div> 
</div> 
<div class="clearfix"></div> 

무엇이 잘못 될 수 있습니까? 거기에 pdf를 생성하는 다른 선택의 여지가있다. 순서

+0

을 KNP-물어 라이브러리를 사용하는 고려 폐쇄하지 을하고있는 경우 확인 PHP와 HTML을 sintax는 DOMPDF이 작동하지 않습니다 laravel.log 파일에서 오류를 점검하십시오. –

답변

0

확인하는 점 : Laravel 4.를 들어

  • 는 * 당신이 아마보기 페이지의 출력 내용을 렌더링하려고이 DOMPDF 래퍼 https://github.com/barryvdh/laravel-dompdf/tree/0.4

  • 를 사용하는 것이 좋습니다 시도 dinamic 페이지 나누기를 추가하려면 page-break-before : always;를 사용하여 요소의 스타일을 지정하면됩니다. 또는 page-break-after : 항상 .; foreach를 삭제하고 하나 또는 두 개의 정적 요소를 추가하여 한 페이지에 렌더링하십시오.

  • return View::make('emails.myView',$myData)->render();으로 HTML로 렌더링하여 뷰의 오류를 검사하십시오. 일부 HTML 태그를 잘

  • 당신이 당신의 디버그 모드를 설정해야합니다 Laravel https://github.com/barryvdh/laravel-snappy/tree/0.1에 대한