White First Page in Adobe

Asked

Viewed 45 times

0

I am using FPDF class v1.6 to generate reports.

It turns out that when I Gero the Pdfs, in the browser appears right. When I open from Adobe Reader, the first page appears blank only with a logo on top. The other pages appear correctly...

I’m using the latest version of Chrome.

Follows the code:

$pdf = new PDFTrix("P", "mm", "A4");
        $pdf->SetMargins(20, 0, 10);
        $pdf->SetAutoPageBreak(true);
        while ($dados->LeProxReg())
        {
//             consulta quantas bombonas foram coletadas e quantos quilos foram coletados
            $sql->ConsSeleEResultado("Sum(PesoColetado) as PesoTotal, count(*) as Qtd", "ColBom", 
               "IDFecham = " . $dados->Campo("ID") . " and PesoColetado > 0");
            $pdf->AddPage();
            if ($tipo_impr == "P")
            {
                $pdf->SetXY(20, 20);
                $pdf->Cell(20, 20, $pdf->Image(DIR_IMG . "/" . $empresa["NomeLogo"], $pdf->GetX(), $pdf->GetY(), 50), 0, 0, 'L', false );       
                $pdf->SetXY(40, 100);
                $pdf->Cell(150, 150, $pdf->Image(DIR_IMG . "/fundoBrascon.jpg", $pdf->GetX(), $pdf->GetY(), 120), 0, 0, 'L', false );
            }       
            $pdf->SetXY(1, 70);
            $pdf->SetFont("Arial", "B", 36);
//              $pdf->SetTextColor(77, 178, 84);
            $pdf->Cell(210, 10, "CERTIFICADO", 0, 3, "C");
            $pdf->SetTextColor(0, 0, 0);
            $pdf->SetXY(1, 100);
            $pdf->SetFont("Arial", "B", 20);
            $pdf->Cell(180, 10, "No " . sprintf("%08s", $dados->Campo("ID")) . "/" . AnoM($dados->Campo("DatFim"))
               , 0, 0, "R");
            $pdf->SetXY(20, 130);
            $pdf->SetFont("Arial", "", 14);     
            $text = "Atesto para os devidos fins que a empresa " . $empresa["Nome"] . ", CNPJ: " . 
               FormataCNPJ($empresa["CNPJ"]) . " RLO: " . $dados->Campo("RLO") . ", realizou os serviços de coleta, transporte, " . 
               "tratamento (autoclavagem) e/ou (incineração) e disposição final " . 
               ($sql->Campo("Qtd") > 0 ? "de " . $sql->Campo("Qtd") . " bombonas com " . 
               FormataNumDecVar($sql->Campo("PesoTotal")) ." quilos (Kg) " : "") . "de resíduos " . 
               "do serviço de saúde  do Grupo A/B/E, no " . 
               "período de " . MToB($dados->Campo("DatInicio")) . " à " . MToB($dados->Campo("DatFim")) . 
               ", conforme preconiza a CONAMA-358. referente à nota fiscal " . 
               "Nº: " . $dados->Campo("NumeroNFe") . " emitida para o tomador do serviço, " . $dados->Campo("Nome") . 
               ", CNPJ/CPF: " . ($dados->Campo("EhPessJuridic") == "S" ?
               FormataCNPJ($dados->Campo("CNPJ")) : FormataCPF($dados->Campo("CPF"))) . ", sito a " . 
               $dados->Campo("Endereco") . ", Nº:" . $dados->Campo("Numero") . ", " . $dados->Campo("Bairro") . 
               ", " . $dados->Campo("NomeCidade") . " - " . $dados->Campo("Estado") . ", sendo estes encaminhados " . 
               "para disposição final, na empresa CENTRAL DE TRATAMENTO DE RESÍDUOS LTDA. – CTR-PE, CNPJ: 07.534.580/0001-46, RLO n° 05.15.02.000491-9, com endereço na " . 
               "BR 101 Norte, Km 28.5, – Zona Rural de Igarassu – Pernambuco - PE";
//              $pdf->WordWrap($text,160);
//              $pdf->Write(5, $text);
            $pdf->MultiCell(165, 5, $text, 0, "J");

            $pdf->SetXY(10, 220);
            $pdf->SetFont("Arial", "", 12);
            $pdf->Cell(160, 10, ImpDatExt($bd, $empresa["Cidade"], DataAtual()), 0, 0, "R");

            $pdf->SetXY(75, 240);
            $pdf->Cell(40, 40, $pdf->Image("./fotos/" . $dados->Campo("AssResponsavel"), $pdf->GetX(), $pdf->GetY(), 50), 0, 0, 'L', false );
        }
        if(ob_end_clean())
            $pdf->Output("Certificado.pdf", "I");

Detail that this only happens when you enter this if (ie... in the use of log and watermark images):

if ($tipo_impr == "P")

Otherwise it rotates normally!

I DECIDED PERSONAL: I removed the images from inside the cell.

if ($tipo_impr == "P")
            { 
                $pdf->SetXY(20, 10);
                $pdf->Image(DIR_IMG . "/" . $empresa["NomeLogo"], 20, 20, 50);      
                $pdf->SetXY(40, 80);
                $pdf->Image(DIR_IMG . "/fundoBrascon.jpg", 40, 80, 120);
            }
  • in firefox it tbm opens blank... in any other it opens normal... =//

  • Only of the problem when it enters that if that inserts the mark Water and the logo! performing some tests I found that when it enters in the if, if I include the two images, the first predominates and add the rest...I commented the line of the first, the second image (mark Water) predominates and add the text, placing only the first, it predominates and add the text! anyone have any idea? and detail that only happens on the first page of the pdf!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.