无法使用javascript使用barryvdh / snappy在页面中放置特定内容

时间:2018-08-08 16:09:10

标签: javascript laravel-5 laravel-snappy

我正在尝试在pdf的某些页面中放入行,但是snappy只是忽略了它,奇怪的是,有些东西(例如打印偏移高度)成功应用,该行应该出现在不大于该行的页面中仅页面大小,但它会显示在所有页面中,而不是大于或不大于页面大小,有人可以帮助我了解最新情况吗?我正在使用Laravel 5.29。

这就是我生成页面的方式

<body>
    <h1 class="titulo-prova clearfix">{{$dados[0]['anunciado']->nome}}</h1>
    <!-- <p id="qtd"> olo</p> -->
    @foreach ($dados as $val)
    @if($val['anunciado']->tipo_da_questao == 1 )
        <div class="page verify">
            <div class="marg">
                <!-- <img class="logo" style="width: 20%; " src="{{asset('images/estacio-logo.jpg')}}"> -->
                <h3 class="cabecalho-questao"><span>QUESTÃO {{$val['anunciado']->id}}</span></h3>
                <p></p>
            </div>
            <p>{!!$val['anunciado']->descricao!!}</p>

            <table>         
                @foreach ($val['questoes'] as $key => $ques)                
                <tr>
                    <td><img style="width: 27px" src="{{asset($alternativas[$key])}}"></td>
                    <td><p>{!!$ques->descricao!!}</p></td>
                </tr>               
                @endforeach
            </table>
            <h4><span class="free-area" style="display: none;">Área Livre</span></h4>
            <!-- @include('profiles.footer') -->
        </div>
        @else 
        <div class="one-column verify">
            <div class="marg">
                <!-- <img class="logo" style="width: 20%; " src="{{asset('images/estacio-logo.jpg')}}"> -->
                <h3 class="cabecalho-questao"><span>QUESTÃO {{$val['anunciado']->id}}</span></h3>
            </div>
            {!!$val['anunciado']->descricao!!}
            <img class="rascunho" src="{{asset('images/rascunho prova.jpg')}}">
            <h4><span class="free-area" style="display: none">Área Livre</span></h4>
            <!-- @include('profiles.footer') -->
        </div>
    @endif
    @endforeach

这是放置行的javascript

document.addEventListener("DOMContentLoaded", function(){
        var items = document.getElementsByClassName('verify');
        for(let i = 0; i < items.length; i++){
            let item = items.item(i);
            // console.log(item.offsetHeight);
            if(item.offsetHeight < 600 || true ){
                // console.log(item);
                item.getElementsByClassName('free-area').item(0).style.display = null;
            }
        }
    });

希望有人可以帮助我

0 个答案:

没有答案