在wkhtmltopdf分页后,如何找到第二页中html加载的哪一部分?

时间:2019-03-20 05:16:48

标签: html laravel pdf wkhtmltopdf

我已根据html内容follow last answer for page break动态管理分页符

现在我需要知道分页后显示的是哪个HTML组件,这意味着第二页。这是因为我的pdf第二页需要不同的样式。

这是我的html

<div class="template-007">
<div class="col-left float-left">
    <div class="false-padding"></div>
    <div class="profile">

        <div class="username">
            <h2>{{ $section['info']['data']['first_name'] }} {{ $section['info']['data']['last_name'] ?? null }}</h2>
        </div>
        <div class="position">
            <p>{{ $section['info']['data']['designation'] ?? null }}</p>
        </div>
        @if ($section['career']['data'] != null)
            <div class="about-me">
                <h2><b>{{ $section['career']['title'] }}</b></h2>
                {!! $section['career']['data']['summary'] !!}
            </div>
        @endif
    </div>

    @if ($section['experience']['data'] != null)
        <div class="section-wrapper">
            <div class="section-title">
                <div class="shape-rounded float-left">
                    <p>{{ $section['experience']['title'] }}</p>
                </div>

            </div>
            <div class="content">
                @foreach($section['experience']['data'] as $exp)
                    <div class="content-row">
                        <div class="institution float-left">
                            <p class="title">
                                {{ $exp['company'] }}
                            </p>
                            <p class="time-period">
                                {{ \Carbon\Carbon::parse($exp['date_from'])->format('M Y') }} -

                                @if( $exp['date_to'] == 'present')
                                    Present
                                @else
                                    {{ \Carbon\Carbon::parse($exp['date_from'])->format('M Y') }}
                                @endif
                            </p>
                        </div>
                        <div class="position float-left">
                            <div class="title">{{ $exp['title'] }}</div>
                            <div class="desc">{!! $exp['description'] !!}</div>
                        </div>
                    </div>
                @endforeach
            </div>
        </div>
    @endif

    @if(strlen($section['certification']['data']['details']) >  6)
        <div class="content-list-wrapper keep-together">
            <div class="section-title">
                <div class="shape-rounded float-left">
                    <p>{{ $section['certification']['title'] }}</p>
                </div>
                <div class="line float-left">
                </div>
            </div>
            <div class="content-left">
                <div class="content-list">
                    <div class="list">
                        <p>{!! $section['certification']['data']['details'] !!}</p>
                    </div>
                </div>
            </div>
        </div>
    @endif
    @if(strlen($section['curricular']['data']['details']) >  6)
        <div class="content-list-wrapper keep-together">
            <div class="section-title">
                <div class="shape-rounded float-left">
                    <p>{{$section['curricular']['title']}}</p>
                </div>
                <div class="line float-left"></div>
            </div>
            <div class="content-left">
                <div class="content-list">
                    <div class="list">
                        <p>{!! $section['curricular']['data']['details'] !!}</p>
                    </div>
                </div>
            </div>
        </div>
    @endif

    @if(strlen($section['portfolio']['data']['details']) >  6)
        <div class="content-list-wrapper keep-together">
            <div class="section-title">
                <div class="shape-rounded float-left">
                    <p>{{$section['portfolio']['title']}}</p>
                </div>
            </div>
            <div class="content-left">
                <div class="content-list">
                    <div class="list">
                        <p>{!! $section['portfolio']['data']['details'] !!}</p>
                    </div>
                </div>
            </div>
        </div>
    @endif

    @if($section['reference']['data'] != null)
        <div class="content-list-wrapper keep-together">
            <div class="section-title">
                <div class="shape-rounded float-left">
                    <p>{{ $section['reference']['title'] }}</p>
                </div>
            </div>
            <div class="content-left">
                <div class="reference-list">
                    @foreach($section['reference']['data'] as $reference)
                        <div class="item">
                            <p>
                                {!! $reference['details'] !!}
                            </p>
                        </div>
                    @endforeach
                </div>
            </div>
        </div>
    @endif
</div>

<div class="col-right">
    <div class="false-padding"></div>
    <div class="avatar">
        <div class="cutout"></div>
        @if ($section['info']['data']['image'] != null)
            <img src="{{ public_path('/storage/'.$section['info']['data']['image']) }}" />
        @else
            <img src="{{ public_path('/images/default-user.png') }}" alt="">
        @endif
    </div>

    <div class="section-wrapper keep-together">
        <div class="contact">
            <ul>
                <li>Phone: {{ $section['info']['data']['phone'] ?? null }}</li>
                <li>Email: {{ $section['info']['data']['email'] ?? null }}</li>
                @if (isset($section['info']['data']['skype']))
                    <li>Skype: {{ $section['info']['data']['skype']}}</li>
                @endif
                <li>Address: {{ $section['info']['data']['present_address'] ?? null }}</li>
            </ul>
        </div>
    </div>

    @if($section['education']['data'] != null)
        <div class="section-wrapper keep-together">
            <div class="section-title">
                <div class="shape-rounded float-left">
                    <p>{{$section['education']['title']}}</p>
                </div>
            </div>
            <div class="content">
                @foreach($section['education']['data'] as $education)
                    <div class="content-row">
                        <div class="institution float-left">
                            <p class="title">
                                {{ $education['institute'] }}
                            </p>
                            <p class="time-period">
                                {{ \Carbon\Carbon::parse($education['start_date'])->format('Y') }} -
                                {{ \Carbon\Carbon::parse($education['end_date'])->format('Y') }}
                            </p>
                        </div>
                        <div class="degree float-left">
                            <div class="title">{{ $education['degree'] }}</div>
                            <div class="desc">CGPA/GPA: {{ $education['grade'] }}</div>
                        </div>
                    </div>
                @endforeach
            </div>
        </div>
    @endif

    @if($section['technical_skill']['data'] != null)
        <div class="section-wrapper keep-together">
            <div class="section-title">
                <div class="shape-rounded">
                    <p>{{$section['technical_skill']['title']}}</p>
                </div>
            </div>
            <div class="progress-content">
                @foreach($section['technical_skill']['data'] as $skill)
                    <div class="content-row">
                        <div class="type float-left">
                            <p class="title">
                                {{ $skill['name'] }}
                            </p>
                        </div>
                        <div class="skill-progress float-right">
                            <div class="circle-wrapper">
                                @for($level = 0; $level < 5; $level++)
                                    @if($level < $skill['level'])
                                        <i class="circle-checked"></i>
                                    @else
                                        <i class="circle-empty"></i>
                                    @endif
                                @endfor
                            </div>
                        </div>
                    </div>
                @endforeach
            </div>
        </div>
    @endif

    @if ($section['language']['data'] != null )
        <div class="section-wrapper keep-together">
            <div class="section-title">
                <div class="shape-rounded">
                    <p>{{$section['language']['title']}}</p>
                </div>
            </div>
            <div class="progress-content">
                @foreach ($section['language']['data'] as $language)
                    <div class="content-row">
                        <div class="type float-left">
                            <p class="title">
                                {{ $language['name'] }}
                            </p>
                        </div>
                        <div class="skill-progress float-right">
                            <div class="circle-wrapper">
                                @for($level = 0; $level < 5; $level++)
                                    @if($level < $language['level'])
                                        <i class="circle-checked"></i>
                                    @else
                                        <i class="circle-empty"></i>
                                    @endif
                                @endfor
                            </div>
                        </div>
                    </div>
                @endforeach
            </div>
        </div>
    @endif
</div>

second page content width should be 100%

但是任何内容都应该在第二页中。

0 个答案:

没有答案