Comunidad de diseño web y desarrollo en internet online

crear pdf de una imagen capturada de ImageSnapshot

Citar            
MensajeEscrito el 25 Mar 2008 10:11 pm
tengo una imagen que ha sido capturada por ImageSnapshot
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();
?>

Por tetito

1 de clabLevel



Genero:Masculino  

firefox
Citar            
MensajeEscrito el 26 Mar 2008 11:17 am

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 26 Mar 2008 05:01 pm

solisarg escribió:

Te falta crear la imágen, ya que lo que manda es un string larguísimo con la descripción de cada pixel. Puedes convertirlo a jpg antes de pasarlo por la clase del pdf, mírate http://henryjones.us/articles/using-the-as3-jpeg-encoder

Jorge



gracias pude crear la imagen.... pero no el pdf!!! en fin creo que lo dejare como imagen pero si alguien puede hacerlo pdf aun me seria de mucha ayuda como cultura general

Por tetito

1 de clabLevel



Genero:Masculino  

firefox
Citar            
MensajeEscrito el 26 Mar 2008 05:44 pm
Si sabes crear la imagen, solo te faltaría pasársela a tu función header, porque creo que espera ese input, una imágen, ¿no?

$this->Image('$logo',10,8,33);

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.