y bueno necesito crear un pdf de esa imagen!!! ya intente todo y use libreria fpdf
pero para crear imagenes ahi se necesita que tengan extension y yo aun no se como hacer eso!!! espero su ayuda ya que lo necesito en verdad... solo eso me falta... espero ayudas o opciones de como realizar eso...
Código :
private function takeSnapshot(source:IBitmapDrawable):void {
ImageSnapshot.defaultEncoder = PNGEncoder;
var cadenaimagen:String= new String;
var imageBitmapData:BitmapData = ImageSnapshot.captureBitmapData(source);
var ohSnap:ImageSnapshot = ImageSnapshot.captureImage(source);
cadenaimagen = ImageSnapshot.encodeImageAsBase64(ohSnap);
swfLoader.source = new Bitmap(imageBitmapData);
var imagenes:Bitmap= new Bitmap(imageBitmapData);
ar auxiliar:pdfcreate =new pdfcreate();
auxiliar.imagenpdf(imagenes,cadenaimagen);
}script as
Código :
public function imagenpdf(imagen:Bitmap,cadena:String):void {
//Pass the htmltable in a variable so that it can be delivered
//to the backend script
var variables:URLVariables = new URLVariables();
variables.imagen=cadena.toString();
//Setup a new request and make sure that we are
//sending the data through a post
var u:URLRequest = new URLRequest(urlpdfexport);
u.data = variables; //Pass the variables
u.method = URLRequestMethod.POST; //Don't forget that we need to send as POST
//Navigate to the script
//We can use _self here, since the script will through a filedownload header
//which results in offering a download to the user (and still remaining in you Flex app.)
navigateToURL(u,"_self");
} sript php
Código :
<?php
include('fpdf.php');
$logo= $_POST["imagen"];
class PDF extends FPDF
{
//Cabecera de página
function Header()
{
//Logo
$this->Image('$logo',10,8,33);
//Arial bold 15
$this->SetFont('Arial','B',15);
//Movernos a la derecha
$this->Cell(80);
//Título
$this->Cell(30,10,'Title',1,0,'C');
//Salto de línea
$this->Ln(20);
}
//Pie de página
function Footer()
{
//Posición: a 1,5 cm del final
$this->SetY(-15);
//Arial italic 8
$this->SetFont('Arial','I',8);
//Número de página
$this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
}
}
//Creación del objeto de la clase heredada
$pdf=new PDF();
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->Output();
?> 