Question

The SWF is located on a web server. I am calling the function using this code in AS3...

myPDF.save(Method.REMOTE, "http://www.example.com/generator/createpdf.php",
 Download.ATTACHMENT, "line.pdf");

Here is my PHP script located on the server...

$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.';

It used to work, but stopped a while back. Any help would be greatly appreciated.

Was it helpful?

Solution

1) This stopped working for me as well, until I added the following -

if(!$HTTP_RAW_POST_DATA){

$HTTP_RAW_POST_DATA = file_get_contents(‘php://input’); }

2) I also patched /src/org/alivepdf/pdf/PDF.as::save() per this post enter link description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top