简体   繁体   中英

I have a problem with html2pdf library, in specific with the second page

When the second page is created the text that should be justified, has a weird indentation to the right, about 20px. The problem happens only after the 2nd page and rarely creates this particular indentation. When I put the text on a div the justified is rendered correctly but the first page is created as a blank page. My code is the next:

<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

问题出在我的代码的这一部分"<img class="logo" src="public/images/blank.png">"我不得不把它放在一张桌子里,然后问题就解决了(我没有知道为什么这适用于第二页)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM