我尝试过dompdf,但没有运气!
我正在使用laravel 5的刀片模板引擎,我想转换使用刀片模板引擎创建的html文件。
我使用了dompdf,使用刀片语法测试它,但它会抛出错误。但是当我在其中输入普通的html页面时,它可以正常工作并将html代码转换为pdf。
请建议我任何与刀片兼容的html到pdf转换器!
请帮助伙伴:)
<body class="homepage skin-blue fixed">
<input type="hidden" name="_token" id="_token" value="{{ csrf_token() }}" />
<div class="header1">
<div class="slider1">
<li class="cards">
<span class="closeFeedback"></span>
<li class="heading_orange"><a>Heading</a></li>
<li>
<ul class="inline_text">
<li>
<a>AZ</a>
<a><p>FLAG</p></a>
</li>
<li>
<a>{{$data->er->name}}</a>
<a>
{!!Form::select('tenure',$data->terms,$data->id,array('class'=>'form-control tenure','style'=>'margin-left: -6%;margin-top: -5%;width: 112%'));!!}
</a>
<a>Marks <span class="list_number">2</span></a>
</li>
</ul>
</li>
<li class="councillor_box bgcolor_faintwhite "><a>Age <span class="list_number">{{$data->age}}</span></a></li>
<li class="bgcolor_lightblue bgcolor_faintwhite"><a class="text_align_left">Questions Asked</a>
<ul>
@foreach($data->question_count as $question)
<li class="box_border"><a>{{$question->name}}<span class="list_number">{{$question->count}}</span></a></li>
@endforeach
<li class="box_border see_more" type="questionAsked"><a>See more</a></li>
</ul>
</li>
<li class="bgcolor_faintwhite bgcolor_lightblue"><a class="text_align_left">Money Spent</a>
<ul>
@foreach($data->money_spent_count as $money)
<li class="box_border"><a>{{$money->name}}<span class="list_number">{{$money->actual_spent_amount}}</span></a></li>
@endforeach
<li class="box_border see_more" type="moneySpent"><a>See more</a></li>
</ul>
</li>
<li class="bgcolor_faintwhite bgcolor_lightblue"><a>Attendance <b class="heading_number_councillor_attendance">65%</b></a>
<ul>
<li id="third_level_first"><a class="light_orange">2015 <b>65%</b></a>
<ul>
<li><a class=" bg_light_orange">General Body Meetings
<span class="text_right">00</span></a>
</li>
<li><a class=" bg_light_orange">Committee 1
<span class="text_right">00</span></a>
</li>
<li><a class=" bg_light_orange">Committee 2
<span class="text_right">00</span></a>
</li>
</ul>
</li>
</ul>
</li>
<li class="councillor_box bgcolor_faintwhite bgcolor_lightblue"><a>Issues</a>
<ul>
<li id="third_level_first"><a class="light_orange">Civic
</a>
<ul>
<li><a class=" bg_light_orange tinybox_border">Top Civic Issues</a></li>
@if(empty($data->Civic['issue']))
<li><a class=" bg_light_orange">None</a></li>
@else
@foreach($data->Civic['issue'] as $issue)
<li class="issues" issue_type = "civic"><a class=" bg_light_orange">{{$issue['name']}}<span class="text_right">{{$issue['count']}}</span></a></li>
@endforeach
@endif
<li id="third_level_second"><a class="amit bg_light_orange text_center">Questions Asked on Civic Issues</a></li>
@if(empty($data->Civic['question']))
<li><a class=" bg_light_orange">None</a></li>
@else
@foreach($data->Civic['question'] as $question)
<li><a class=" bg_light_orange">{{$question['name']}}<span class="text_right">{{$question['count']}}</span></a></li>
@endforeach
@endif
</ul>
</li>
<li id="third_level_first"><a class="light_orange">Health
</a>
<ul>
<li><a class=" bg_light_orange tinybox_border" >Top Diseases/Ailments</a></li>
@if(empty($data->Health['issue']))
<li><a class=" bg_light_orange">None</a></li>
@else
@foreach($data->Health['issue'] as $question)
<li class="issues" issue_type = "health"><a class=" bg_light_orange">{{$question['name']}}<span class="text_right">{{$question['count']}}</span></a></li>
@endforeach
@endif
<li id="third_level_second"><a class="bg_light_orange text_center">Questions asked on Health</a></li>
@if(empty($data->Health['question']))
<li><a class=" bg_light_orange">None</a></li>
@else
@foreach($data->Health['question'] as $question)
<li><a class=" bg_light_orange">{{$question['name']}}<span class="text_right">{{$question['count']}}</span></a></li>
@endforeach
@endif
</ul>
</li>
<li id="third_level_first"><a class="light_orange">Education
</a>
<ul>
<li><a class=" bg_light_orange tinybox_border" >Statistics</a></li>
@if(empty($data->Education['issue']))
<li><a class=" bg_light_orange">None</a></li>
@else
@foreach($data->Education['issue'] as $question)
<li class="issues" issue_type = "education"><a class=" bg_light_orange">{{$question['name']}}<span class="text_right">{{$question['count']}}</span></a></li>
@endforeach
@endif
<li id="third_level_second"><a class="bg_light_orange text_center">Questions Asked on Education</a></li>
@if(empty($data->Education['question']))
<li><a class=" bg_light_orange">None</a></li>
@else
@foreach($data->Education['question'] as $question)
<li><a class=" bg_light_orange">{{$question['name']}}<span class="text_right">{{$question['count']}}</span></a></li>
@endforeach
@endif
</ul>
</li>
<li id="third_level_first"><a class="light_orange">Other
</a>
<ul>
<li><a class=" bg_light_orange tinybox_border" >Issues</a></li>
@if(empty($data->Crime['issue']))
<li><a class=" bg_light_orange">None</a></li>
@else
@foreach($data->Crime['issue'] as $question)
<li class="issues" issue_type = "crime"><a class=" bg_light_orange">{{$question['name']}}<span class="text_right">{{$question['count']}}</span></a></li>
@endforeach
@endif
<li id="third_level_second"><a class="bg_light_orange text_center">Questions Asked on Other Issues</a></li>
@if(empty($data->Crime['question']))
<li><a class=" bg_light_orange">None</a></li>
@else
@foreach($data->Crime['question'] as $question)
<li><a class=" bg_light_orange">{{$question['name']}}<span class="text_right">{{$question['count']}}</span></a></li>
@endforeach
@endif
</ul>
</li>
</ul>
</li>
<li class="bgcolor_faintwhite bgcolor_darkblue"><a >Contact</a>
<ul>
<li class="nine_px smallbox_border full_width"><a class=" text_left full_width" >For All Complaints
<span class="text_right">1916</span></a>
</li>
<li class="full_width address_box"><a class=" text_left nine_px" >{{$data->erDetails->address}},{{$data->erDetails->city_name}},{{$data->erDetails->pincode}},{{$data->erDetails->state_name}}</a></li>
<li class="contact_social nine_px">
<a class=" full_width">WEBSITE</a>
<a class=" full_width">F</a>
<a class=" full_width">T</a>
</li>
</ul>
</li>
<li class="bgcolor_faintwhite equalbox"><a >Other Councillors From Same Ward (H/W)</a></li>
<li class="bgcolor_faintwhite equalbox"><a >Other ERs In Constituency</a></li>
<li class="bgcolor_faintwhite equalbox"><a >Top & Bottom Councillors of Mumbai</a></li>
<li class="bgcolor_faintwhite equalbox"><a >Download Report Card</a></li>
<li class="social_network">
<span class="pad_0px">
<a onclick="openShareDialog('facebook', this);" data-link="">Share</a>
<a onclick="openShareDialog('twitter', this);" data-link="">Tweet</a>
<a class="download">Download</a>
</span>
</li>
</ul>
</li>
</div>
</div>
<div class="example-modal">
<div class="modal" id='message-modal'>
</div>
</div>
</body>
这是我的php刀片视图文件,将以pdf格式下载。
pdf转换如下
$html = App::make('dompdf.wrapper');
$html = $html->loadHtml(view('cards.pdf_card',compact('data'))->render());
return $html->download('card.pdf');
此处的'数据'被认为是之前生成的。
错误如下,
ErrorException in frame.cls.php line 765:
Argument 1 passed to DOMNode::appendChild() must be an instance of DOMNode, null given, called in /opt/lampp/htdocs/brt_praja/vendor/dompdf/dompdf/include/table_frame_decorator.cls.php on line 312 and defined
提前感谢您的帮助。