使用mPDF时,跨度不旋转

时间:2019-03-22 15:03:49

标签: mpdf

    $css  = '
        <style>

            * {
                margin: 0;
                padding: 0;
            }

            div.titulos {
                height: 200px;
                background-color: #CCC;
            }

            div.registros {
                height: 30px;
                border-top: none;
            }

            div.titulos, 
            div.registros { 
                width: 870px;
                margin: 0 auto;
                border: thin solid #000;
            }

            div.titulos div, 
            div.registros div {
                float: left;
                text-align: center;
                vertical-align: middle;
                border-left: thin solid #000;
            }

            div.titulos div:nth-child(1), 
            div.registros div:nth-child(1) {
                border-left: none;
            }

            span {}

            span.normal {}

            span.rotate {
                height: 200px;
                rotate : -90;
                text-rotate : -90;
                writing-mode: vertical-rl;
                transform: rotate(180deg);
                transform-origin: center;
            }

        </style>
    ';

    $body = '   

    <div class="titulos">

        <div style="width: 100px;"><span class=normal>Nome do Gcéu</span></div>
        <div style="width: 100px;"><span class=rotate>Supervisor</span></div>
        <div style="width: 100px;"><span class=normal>Líder</span></div>
        <div style="width: 050px;"><span class=rotate>Houve Supervisão?</span></div>
        <div style="width: 050px;"><span class=rotate>Houve dia de Jejum?</span></div>
        <div style="width: 050px;"><span class=rotate>Houve dia de Evangelismo?</span></div>
        <div style="width: 050px;"><span class=rotate>Membros Compromissados</span></div>
        <div style="width: 050px;"><span class=rotate>Visitantes</span></div>
        <div style="width: 050px;"><span class=rotate>Crianças de 0 a 12 anos</span></div>
        <div style="width: 050px;"><span class=rotate>Total de presentes</span></div>
        <div style="width: 050px;"><span class=rotate>Ofertas</span></div>
        <div style="width: 050px;"><span class=rotate>Discipulados</span></div>
        <div style="width: 050px;"><span class=rotate>Número de decisões</span></div>

    </div>

    <div class="registros">

        <div style="width: 100px;">Gceú</div>
        <div style="width: 100px;">Carlos</div>
        <div style="width: 100px;">Cleo</div>
        <div style="width: 050px;">Sim</div>
        <div style="width: 050px;">Sim</div>
        <div style="width: 050px;">Não</div>
        <div style="width: 050px;">12</div>
        <div style="width: 050px;">3</div>
        <div style="width: 050px;">3</div>
        <div style="width: 050px;">18</div>
        <div style="width: 050px;">12.3</div>
        <div style="width: 050px;">2</div>
        <div style="width: 050px;">1</div>

    </div>  
    ';

    //echo $css.$body;

    require 'vendor/autoload.php';
    $mpdf = new \Mpdf\Mpdf();
    $mpdf->SetDisplayMode( 'fullpage' );
    $mpdf->WriteHTML( $css, 1 );
    $mpdf->WriteHTML( $body );
    $mpdf->Output();

输出为PDF时,代码无法正确输出。

这是PDF输出的示例屏幕截图:

screenshot of pdf output

请注意,跨度为class=rotate,但没有旋转。我可以更改以解决此问题吗?

我需要它能够正常工作,因为在浏览器中显示时会被按下。

我已经使用rotate : -90;text-rotate : -90;writing-mode: vertical-rl;transform: rotate(180deg);进行了尝试,但是这些都不起作用。为什么会这样?

1 个答案:

答案 0 :(得分:0)

mPDF中的text-rotatetrth元素仅支持属性th

transform: rotate仅在img元素上受支持。

另请参阅supported CSS documentation