Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Boa tarde, Amigos.
Tenho um problema. Eu monto um HTML Com PHP e tento gerar um PDF com ele.
Em Host Windows. ele quebra página com page-break.
Em servidores Linux. ele não funciona.
Dá um erro de Premature end of scripts header.
Já tentei quebrar a página com os seguintes.
Demonstrativo_ferias_pdf.php
<div>
<p> com margin bottom.
<p> com margin: 0 0 0 0;
Imagem separadora.
page-break...
criando uma tabela.
<br> umas 20 vezes
<p> umas 10 vezes.
Alguem tem outro método para quebrar a folha?
Pois tentando com os citados acima não dá, ele gera um erro.
@edit.
@Edit2 Vou postar os Arquivos.. para o Willian MOver.
<?
header("Content-type: text/html\n");
header("Pragma: no-cache\n");
header("Cache-Control: no-store, no-cache, must-revalidate\n");
header("Cache-Control: post-check=0, pre-check=0\n", false);
ini_set('display_errors',1);
error_reporting(E_ALL);
session_start();
//include("teste.php");
require_once("../../../conecta.php");
include_once("../../../lang/brazilian_ferias.php");
$_REQUEST["mod"] = "funcionarios";
require_once("../../../lang.php");
if (file_exists("functions/functions.php")) {
include_once("functions/functions.php");
} else {
include_once("../../../functions/functions.php");
}
if($_REQUEST['paramData']){
$data_INI_PERI_select = substr($_REQUEST['paramData'],0,4);
$data_INI_PERI_OUD = ((substr($data_INI_PERI_select,0,4))-1);
$data_ANOMES=date("Ym",strtotime($_REQUEST['paramData']));
}
$query = query("SELECTWHERE FUN.ID_FUNCIONARIO='".$_REQUEST['id']."' AND
FERIAS.DT_INICIO_DESC='".$_REQUEST['paramData']."' AND
DIREI.INICIO_PERIODO_AQ = FERIAS.INICIO_PERIODO_AQ
AND FERIAS.SEQUENCIA='".$_REQUEST["seq"]."'");
//DAtas Para periodo Aquisitivo de 2007 a 2008;$raar = fassoc($query);
// Data em potuguês
$estadoConv = ConvertUF($raar['UF']);
setlocale(LC_TIME,"portuguese");
$data_completa = strftime(" %A, %d de %B de %Y");
if($raar){
$html="<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">
<html>
<head>
<style>
body{
font-family: \"Helvetica\", \"sans-serif\";
font-size:10px;
margin:33px;
text-align:center;
}
table1{
font-size:10px;
text-align:center;
border:1px solid black;
margin-bottom:5px;
border-spacing: 0px;
border-collapse: collapse;
}
table{
font-size:10px;
text-align:left;
border:1px solid black;
margin-bottom:5px;
border-spacing: 0px;
border-collapse: collapse;
}
th{
margin-left:0px;
font-size:10px;
font-weight: bold;
} margin-left:31px;
margin-right:28px;
margin-bottom:31px;
}
</style>
<meta content=\"text/html; charset=ISO-8859-1\" http-equiv=\"content-type\">
</head>
<body><table width=\"100%\" border=\"0\">
<tr><th><center>"._TIT_FERIAS_."</center></th></tr>
</table>
<p> </p>
<table width=\"100%\" border=\"0\">
<tr><td> </td></tr>
<tr><td> "._ORGAO_."".$raar['IDE_ORGAO']." - ".$raar['ORGAO']."</td></tr>
<tr><td><br> "._FUNC_.": ".$raar['ID_FUNCIONARIO']." ".$raar['NOME']."</td></tr>
<tr><td><br> "._LINHA1_."".$raar['INICIO_PERIODO_AQ']." "._A_." ".$raar['FIM_PERIODO_AQ']."</td></tr>
<tr><td> "._LINHA2_." ".$raar['DT_INI_DESC']." "._LINHA2PT2_." ".$raar['DT_FIM_DESC']." "._PROX_."</td></tr>
<tr><td> </td></tr>
<tr><td>".$estadoConv." - ".$data_completa."</td></tr>
<tr><td> </td></tr>
<tr><td><span>________________________________</span> ".$raar['NOME_FILIAL']." <br> <span>"._FUNC_."</span> </td></tr>
<tr height=\"200px\"><td> </td></tr>
</table>
<div id=\"end1\">
<br>
<br>
<hr><br>
<br>
<br>
</div>";
//INclui segunda parte do aviso/recibo
include_once("recibo_ferias.php");
} else {
if (file_exists("functions/class/log.class.php")) {
include_once("functions/class/log.class.php");
} else {
include_once("../../../functions/class/log.class.php");
}
$log = new logs();
if($_SESSION['PERFIL']=='S'){
$btClick = _IMPRES_FER_ERRO;
$log->addFULL_staff($_SESSION['logs']['ID'],$_SESSION['TELAIN'],$_SESSION['logs']['USUARIO'],$_REQUEST['ID_FUNCIONARIO'],$btClick); $btClick = _IMPRES_FER_ERRO;
$log->addFULL($_SESSION['logs']['ID'],$_SESSION['TELAIN'],$_SESSION['logs']['USUARIO'],$btClick);
}
echo ERRO_GERA_PDF_;
}
?>
Recibo_ferias.php
<?
if(!$_SESSION)session_start();
require_once("../../../conecta.php");
$_REQUEST["mod"] = "funcionarios";
include_once("../../../lang/brazilian_ferias.php");
if (file_exists("functions/functions.php")) {
include_once("functions/functions.php");
} else {
include_once("../../../functions/functions.php");
};
//Colocar <b>AND VERB.TIPO_PAGTO='T'</b>if($raar){
$html .="<table width=\"100%\" border=\"0\">
<tr><td><center>"._ORGAO." ".$raar['IDE_ORGAO']." - ".$raar['ORGAO']."</center></td></tr>
<tr><th><center>"._FERIASRECTIT_."</center></th></tr>
<tr><th><center> </center></th></tr>
</table>
<table width=\"100%\" border=\"0\">
<tr height=\"55px\">
<td width=\"70%\"> "._FUNC_.": ".$raar['ID_FUNCIONARIO']." ".$raar['NOME']."
</td>
<td width=\"30%\">
<div align=\"right\">"._SALARIO_." ".number_format($raar['SALARIO'],2,',','.')."<br>
"._MEDHE_." ".$raar['MEDIA_HORAS']."</div></td>
</tr>
</table>";$queryVenci= query("SELECT * from fp_acum_verbas
WHERE IDE_FUNCIONARIO='".$_REQUEST['id']."' and ANOMES_COMP = '".$data_ANOMES."' and tipo_pagto='F'");$totalSomas ="0.00";
$totalDescs = "0.00";
$VALORliquido = "0.00";
$numV=0;
$numD=0;
while($arr = farray($queryVenci)){
if($arr['TIPO_VERBA']=="V"){
$dadosVencis[$numV] =
array(1 => $arr['COD_VERBA'],
2 => $arr['DESCR_VERBA'],
3 => number_format($arr['REFERENCIA'],2,',','.'),
4 => number_format($arr['VALOR'],2,',','.'));
$numV++;
$totalSomas += $arr['VALOR'];
}
if($arr['TIPO_VERBA']=="D"){
$dadosDesc[$numD] =
array(1 => $arr['COD_VERBA'],
2 => $arr['DESCR_VERBA'],
3 => number_format($arr['REFERENCIA'],2,',','.'),
4 => number_format($arr['VALOR'],2,',','.'));
$numD++;
$totalDescs += $arr['VALOR'];
}
}
/*************************/
//and tipo_verba='V' and tipo_pagto='T'
$html .="<table width=\"100%\" border=\"0\">
<tr height=\"45px\">
<th width=\"50%\" style='text-align: left;'> "._TIT_VEN_."</th>
<th width=\"20%\" style='text-align: center;'>"._TIT_REF."</th>
<th style='text-align: right;' width=\"30%\">"._TOTAL_." </th>
</tr>";
for($x=0;$x<$numV;$x++){
$html .= "<tr>";
$html .= "<td style='text-align: left;'> ".$dadosVencis[$x][1]." - ".$dadosVencis[$x][2]."</td>";
$html .= "<td style='text-align: center;'>".$dadosVencis[$x][3]."</td>";
$html .= "<td style='text-align: right;'>".$dadosVencis[$x][4]." </td>";
$html .="</tr>";
}
$html .="<tr height=\"32px\">
<td width=\"50%\" style='text-align: left;'> "._TOTALSOMA_."</td>
<td width=\"20%\" style='text-align: center;'> </td>
<td style='text-align: right;' width=\"30%\">".number_format($totalSomas,2,',','.')." </td>
</tr>";
$html .="</table>"; //END While ARRAY ::: Acaba a tabela de Vencimentos
//ADICIONAR and tipo_pagto='T' NA WHERE acima
//Inicio tabela de DESCONTOS
$html .="<table width=\"100%\">";
$html .=" <tr height=\"45px\">
<th width=\"50%\" style='text-align: left;'> "._TIT_DESC_."</th>
<th width=\"20%\" style='text-align: center;'>"._TIT_REF."</th>
<th style='text-align: right;' width=\"30%\">"._TOTAL_." </th>
</tr>";
for($x=0;$x<$numD;$x++){
$html .= "<tr>";
$html .= "<td style='text-align: left;'> ".$dadosDesc[$x][1]." - ".$dadosDesc[$x][2]."</td>";
$html .= "<td style='text-align: center;'>".$dadosDesc[$x][3]."</td>";
$html .= "<td style='text-align: right;'>".$dadosDesc[$x][4]." </td>";
$html .= "</tr>";
}
$html .="<tr height=\"45px\">
<td width=\"50%\" style='text-align: left;'> "._TOTALSOMA_."</td>
<td width=\"20%\" style='text-align: center;'> </td>
<td style='text-align: right;' width=\"30%\">".number_format($totalDescs,2,',','.')." </td>
</tr>";
$html .="</table>";
//FIM DESCONTO
//SOMA total do Liquido a Receber
$VALORliquido = ($totalSomas - $totalDescs);
$html .="<table width=\"100%\">";
$html .="<tr height=\"25px\"><th style='text-align: left;'>"._LIQUIDO_."</th><th> </th><td style='text-align: right;'>".number_format($VALORliquido,2,',','.')." </td></tr>";
$html .="</table>";
//inclui Rodapé Campos para asinatura.
include("rodape_recibo.php");
$html .="</body></html>";
$nome_arquivo =""._FERIASREC_."";
$html = str_replace(" "," ",$html);
$html = str_replace("\r\n","\n",$html);
html2pdf($html,$nome_arquivo,"a4","portrait");
//echo $html;
if (file_exists("functions/class/log.class.php")) {
include_once("functions/class/log.class.php");
} else {
include_once("../../../functions/class/log.class.php");
}
$log = new logs();
if($_SESSION['PERFIL']=='S'){
$btClick = _IMPRES_FER;
$log->addFULL_staff($_SESSION['logs']['ID'],$_SESSION['TELAIN'],$_SESSION['logs']['USUARIO'],$_REQUEST['ID_FUNCIONARIO'],$btClick);
}else{
$btClick = _IMPRES_FER;
$log->addFULL($_SESSION['logs']['ID'],$_SESSION['TELAIN'],$_SESSION['logs']['USUARIO'],$btClick);
}
//echo $html;
//exit;
} else {
echo "<h1>".$html;
}
?>
rodape_recibo.php
<?php
//Gerador de Data
setlocale(LC_TIME,"portuguese");
$data_completa = strftime(" %A, %d de %B de %Y");
$html .="<br><table width=\"475px\" style=\" border:0px\" class=\"ReciboFoot\">";
$html .="<tr>
<td style='text-align: left;' ><center> "._FALTAS_."".$raar['FALTAS']."</center></td>
</tr>";
if(isset($re['DIAS_ABONO'])){
$complemento="+".$raar['DIAS_ABONO']." "._ABONO." ".$raar['INICIO_PERIODO_AQ']." "._A_."".$raar['FIM_PERIODO_AQ']."";
}else{
$complemento=" ";
}
$html .="<tr>
<td style='text-align: left;' ><br> "._RECIBOINI_."".$raar['NOME_FILIAL']." "._RECIBOpt2_."".$raar['DT_FIM_DESC']." "._RETORNO."".$raar['DT_RETORNO'].".</td>
</tr>";
$html .="<tr><td>".$estadoConv." - ".$data_completa."</td></tr>
<tr><td> </td></tr>";
$html.="<tr><td><span>________________________________</span>
".$raar['NOME_FILIAL']."<br> <span>"._FUNC_." </span></td>
</tr><tr><td> </td></tr>";
$html.="</table>";
?>Carregando comentários...