У меня проблема с библиотекой html2pdf, в частности со второй страницей - PullRequest
0 голосов
/ 07 июня 2019

Когда создается вторая страница, текст, который должен быть выровнен, имеет странный отступ справа, около 20 пикселей. Проблема возникает только после 2-й страницы и редко создает этот конкретный отступ. Когда я помещаю текст в div, выровненное изображение отображается правильно, но первая страница создается как пустая страница. Мой код следующий:

<link href="public/css/estilo_oficio.css" rel="stylesheet" type="text/css" >


<page backimg="public/images/fondo_uaem.png" backimgx="center" backimgw="103%" backtop="33mm" backbottom="40mm" backleft="20mm" backright="17mm">
    <page_header>
       <table class="header" align="right" >
           <tr><td class="secretaria"><?=(isset($secretaria)) ? $secretaria:"";?></td></tr>
           <tr><td class="direccion"><?=(isset($direccion)) ? $direccion:"";?></td></tr>

            <!-- Si la variable departamento trae valor se imprime y debajo de el se imprime la leyenda de emilizano zapata,
            en caso de que no tenga valor solo se imprime la leyenda de emiliano zapata -->

            <?php if(isset($departamento)) { ?>

                      <tr><td class="Departamento"><?=$departamento?></td></tr>
                      <tr><td class="leyenda">"2019, a 100 años del asesinato de General Emiliano Zapata Salazar"</td></tr>

            <?php }

                      else{
                       ?>

                      <tr><td class="leyenda">"2019, a 100 años del asesinato de General Emiliano Zapata Salazar"</td></tr>

                <?php } ?>
       </table>
    </page_header>
    <page_footer>
       <table style="width: 100%; margin-top: -80px;">
            <tr>
              <td style="font-family: Arial; font-size: 11px; text-align: left;    width: 100%">Av. Universidad 1001 Col. Chamilpa, Cuernavaca Morelos, México, 62209, 1er. Piso Torre de Rectoría,
              </td>
           </tr>
           <tr>
              <td style="text-align: left;   font-size: 11px; width: 100%">Tel. (777) 329 701 1, 329 70, 00, Ext. 3582 / administracion@uaem.mx
              </td>
           </tr>
       </table>
    </page_footer>

    <img class="logo" src="public/images/blank.png">


    <table class="ubicacion" align="right">
            <tr><td class="fecha"><?=(isset($fecha)) ? $fecha:"";?></td></tr>

            <tr><td class="referencia"><?=(isset($referencia)) ? $referencia:"";?></td></tr>
    </table>

    <!--  tabla de asunto -->

     <?php if(isset($asunto)) {
       if($mostrarAsunto == 1){
       ?>
        <table class="asunto" align="right">
            <tr>
             <td class="asunto-header" >ASUNTO:</td>
             <td class="asunto-content"><?=(isset($asunto)) ? $asunto:"";?></td>
            </tr>
        </table>

      <?php }} ?>

     <!-- fin de tabla asunto -->

    <table class="destinatario">
             <tr><td class="nombre_des"><?=(isset($nombre_des)) ? $nombre_des:"";?></td></tr>
             <tr><td class="puesto_des"><?=(isset($puesto_des)) ? $puesto_des:"";?></td></tr>
    </table>





    <table class="presente">
            <tr><td>P R E S E N T E</td></tr>
    </table>
    <!-- here is the place where the text is rendered -->
   <?=$cuerpo?>  



    <table class="despedida" align="center">
             <tr><td class="atentamente">Atentamente</td></tr>
             <tr><td class="humanidad">Por una humanidad culta</td></tr>
             <tr><td class="excelencia">Una universidad de excelencia</td></tr>
    </table>


    <table class="remitente" align="center">
             <tr><td class="nombre_rem"><?=(isset($nombre_rem)) ? $nombre_rem:"";?></td></tr>
             <tr><td class="puesto_rem"><?=(isset($puesto_rem)) ? $puesto_rem:"";?></td></tr>
    </table>

    <?
      if($cip != ""){
        ?>
        <table class="copia" align="left">
                 <tr><td class="cip">C.c.p -- </td><td class="cip"><?=(isset($cip)) ? $cip:"";?></td></tr>
        </table>
        <?
      }
    ?>

    <?
      if(isset($inicialesReferencia)){
        ?>
        <table class="copia" align="left">
                 <tr><td class="cip"></td><td class="cip"><?=(isset($inicialesReferencia)) ? $inicialesReferencia:"";?></td></tr>
        </table>
        <?
      }

      if(isset($firmaElectronica)) { ?>
            <table style="margin-top: 20px;">
             <tr>
               <td class="">
               <qrcode value="Ejemplo url de firma electronica" ec="H" style="width: 25mm; background-color: white; color: black;"></qrcode>
              </td>
              <td class="">

             </td>
           </tr>
          </table>
      <?}
    ?>

</page>

I let 2 images, the first is rendered ok, the second page is created with a weird indentation (red square)
https://i.stack.imgur.com/kfth8.png
https://i.stack.imgur.com/6bMhC.png

1 Ответ

0 голосов
/ 07 июня 2019

Проблема была в этой части моего кода "<img class="logo" src="public/images/blank.png">" Мне пришлось поместить ее в таблицу, и затем проблема была решена (я не знаю, почему это относится ко второй странице)

...