Hi All. I am a new bee to flex. What i am trying to do is to generate and save the layout design which nothing but canvas to a pdf format at the server. Currently i am able to display the pdf in browser (see the function below:) but cannot save the file at the server.
private function continueToPdf():void{
myPDF = new PDF( Orientation.LANDSCAPE, Unit.MM, Size.A4 );
myPDF.setDisplayMode ( Display.FULL_WIDTH );
myPDF.addPage();
myPDF.addImage(layout_cnv);
myPDF.save( Method.REMOTE, "http://flexindia.org/designtool/upload/create.php",Download.INLINE ,"drawing.pdf" );
}
where layout_cnv is a canvas.Also i am using AlivePDF.swc lbrary for this. The php file at server is create.php
<?php
$method = $_GET['method'];
$name = $_GET['name'];
if ( isset ( $GLOBALS["HTTP_RAW_POST_DATA"] )) {
// get bytearray
$pdf = $GLOBALS["HTTP_RAW_POST_DATA"];
// add headers for download dialog-box
header('Content-Type: application/pdf');
header('Content-Length: '.strlen($pdf));
header('Content-disposition:'.$method.'; filename="'.$name.'"');
echo $pdf;
} else echo 'An error occured.';
?>
Can someone help me please.