New question

Question:

 
  0  
 
Date: 05-08-2019 08:05:28 (In Spanish)

Generar PDF con HTML2PDF[Resolved]

Hola compañer@s,

en esta ocasión tengo un problema al generar un cartel con HTML2PDF, no se por qué no hace caso al CSS que le incluyo en el header, no se si es que hay algunos CSS que no puedo usar o que.

Incluyo el código HTML, ya que el del PHP si está bien porque lo genera pero sin embargo el PDF no quiero ocupar el 100% del ancho.
En este ejemplo el código va INLINE pero he probado también el del Header, de hecho veréis qeu en algunos sitios está la clase CSS y a la vez el estilo INLINE.
<!DOCTYPE HTML>
<html>
	<head>
		<meta charset="UTF-8">
		<style type="text/css">
			
			/* COLORES */
			.cabeceraTabla {background-color:#747474; color:#FFFFFF; padding:5px; box-sizing:border-box;}
			.fondoGrisClaro { background-color:#EBEBEB; padding:5px; box-sizing:border-box;}
			.fondoRojo  {background-color:#FC9192; padding:5px; box-sizing:border-box;}
			.fondoVerde {background-color:#7EE476; padding:5px 5px 5px 0px; box-sizing:border-box;}
			.fondoFirma {display:block; background-color:#E4E4E4; border:1px dotted #ababab; height:90px;}
			.textoCentrado {padding-left:20px; box-sizing:border-box;}
			
			h2 {font-size:20px;}
			
			/* TABLA 1 Datos empresa cliente */
			.columna32 {width:30%;}
			.columna32 p {margin-left:20px; font-size:11px; margin-bottom:5px !important;}
			.columna32 p strong {font-size:12px;}
			.columna32 p span {color:#999; text-decoration:underline;}
			
			.columna36 {width:40%;}
			.columna36 p {margin-left:30px; font-size:13px; margin-bottom:5px !important;}
			.columna36 p strong {font-size:14px;}
			.columna36 p span {color:#999; text-decoration:underline;}
			
			/* TABLA 2 datos vendedor y presupuesto */
			.columna25 {width:25%; padding-left:20px; box-sizing:border-box;}
			.columna50 {width:50%; padding-left:20px; box-sizing:border-box;}
			
			/* TABLA 3 datos articulos normales */
			.columna11 {width:11%; padding-left:15px; box-sizing:border-box;}
			.columna11SinPadding {width:11%; box-sizing:border-box;}
			.columna56 {width:56%; padding-left:15px; box-sizing:border-box;}
			
		</style>
		
	</head>
	
	<body>
		
		<!-- Tabla datos cliente 1 -->
		<table border="0" style="width:100%;">
			<!-- Información superior -->
			<tr>
				<!-- Logotipo -->
				<td><img src="<?= $logoHorizontal; ?>"></td> 
				<!-- Referencia -->
				<td><h4><strong>Referencia: </strong><?= $obj->referencia_interna; ?></h4></td> 
				<!-- info contacto -->
				<td>
					<strong>Email: </strong><?= $emailAgencia ?><br><br>
					<strong>Teléfono: </strong>'.<?= $telefonoAgencia; ?>
				</td>				
			</tr>
			<!-- Título -->
			<tr>
				<td colspan="3" class="textoCentrado" style="text-align: center;"><h3 class="textoCentrado" style="text-align: center;"><?= $obj->titulo; ?></h3></td>
			</tr>
			<!-- Foto -->
			<tr>
				<td colspan="3"><?= $fotoPortada; ?></td>
			</tr>
			<!-- Características y Calidades -->
			<tr>
				<td colspan="3"><h3>Características</h3></td>
			</tr>
			<!-- Localizacion -->
			<tr>
				<td colspan="3">
					<table border="0" style="width:100%;">
						<tr>
							<td>
								<strong>Localidad:</strong> <?= $provincia; ?>								
							</td>
							<td>
								<strong>Zona:</strong> <?= $zona; ?>
							</td>
							<td>
								<strong>C.Postal:</strong>  <?= $obj->cod_postal_real; ?>
							</td>
							<td>
								<strong>Tipo:</strong>  <?= $tipoInmueble; ?>								 
							</td>							
						</tr>
						<tr>
							<td>
								<strong>Superficie:</strong> <?= $obj->superficie; ?>
							</td>
							<td>
								<strong>Habitaciones:</strong> <?= $obj->habitaciones; ?> 
							</td>
							<td>
								<strong>Baños:</strong> <?= $obj->banos; ?>
							</td>
							<td>
								<strong>Altura:</strong> <?= $obj->altura_real; ?>
							</td>
						</tr>
					</table>
				</td>
			</tr>
			<!-- Calidades -->
			<tr>
				<td colspan="3">
					<?= $obj->calidades; ?>	
				</td>				
			</tr>
			<!-- Precio -->
			<tr>
				<td colspan="3"><h3>Precio <?= $precio; ?></h3></td>				
			</tr>
			<tr>
				<td colspan="3"><h4>Pase y amplíe información sobre este inmueble</h4></td>				
			</tr>
		</table>
        
	</body>
	
</html>


La imagen resultante es esta;



Muchas gracias

Tags: HTML - HTML2PDF - PDF - PHP - PHP Advanced - Question Votes: 0 - Answers: 1 - Views: 6 Share on: Google Facebook Twitter LinkedIn Link
 

Answers:

  •  
      0  
     
    Date: 07-08-2019 20:40:21 Hola de nuevo compañeros, ya lo solucioné, después de darle miles de vueltas, me descargue la última versión que existe en internet y empezó a funcionar bien. Lo curioso del tema es que en mi trabajo uso la misma librería y me obedece a todo lo que hago, sin embargo en mi proyecto personal no.
    Lo único que se me ocurre es que sea por diferentes versiones de PHP de los servidores puesto que es la única diferencia entre el de mi trabajo y el mío.
      Votes: 0 - Link answer
     
To actively participate in the community first must authenticate, enter the system.Sign In
 
frjcbbae garagebible.com