-1

Gostaria de gerar uma imagem ou pdf a partir de um arquivo html e enviar o arquivo por email, alguém sabe como posso fazer isso? Já procurei por algumas classes, mas não achei nenhuma ideal.

4
  • Qual linguagem está usando?
    – rray
    22/04/2014 às 12:55
  • Estou usando php para gerar o arquivo html
    – Odair
    22/04/2014 às 12:56
  • 1
    já olhou essa pergunta ?
    – rray
    22/04/2014 às 12:57
  • Use fpdf.org, é bem fácil trabalhar com essa classe
    – user6026
    22/04/2014 às 12:58

1 Resposta 1

1

Utilize FPDF

Exemplo 1:

<?php
require('fpdf.php');

$pdf = new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$pdf->Cell(40,10,'Hello World!');
$pdf->Output();
?>

Refêrencia: http://www.fpdf.org/en/tutorial/tuto1.htm

Exemplo 2:

<?php
require('fpdf.php');

class PDF extends FPDF
{
   // Page header
   function Header()
   {
       // Logo
       $this->Image('logo.png',10,6,30);
       // Arial bold 15
       $this->SetFont('Arial','B',15);
       // Move to the right
       $this->Cell(80);
       // Title
       $this->Cell(30,10,'Title',1,0,'C');
       // Line break
       $this->Ln(20);
   }

   // Page footer
   function Footer()
   {
       // Position at 1.5 cm from bottom
       $this->SetY(-15);
       // Arial italic 8
       $this->SetFont('Arial','I',8);
       // Page number
       $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
   }
}

// Instanciation of inherited class
$pdf = new PDF();
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetFont('Times','',12);
for($i=1;$i<=40;$i++)
    $pdf->Cell(0,10,'Printing line number '.$i,0,1);
$pdf->Output();
?> 

Refêrencia: http://www.fpdf.org/en/tutorial/tuto2.htm

Todos os tutoriais estão no FPDF Tutorial

Scripts prontos é só adequar no FPDF Scripts

Referência Geral: http://www.fpdf.org/

1

Esta não é a resposta que você está procurando? Pesquise outras perguntas com a tag .