actionscript-3flashalivepdf

Save PDF local method using alivepdf, flash as3


I have tried few things but no success. I want to prompt user on button click event to save PDF file in local computer generated from object array which were created by user at runtime.

Any sort of help is greatly appreciated Thanks

I have revised target flash player 10.0 in the html and somehow found out that the save event call has to be on button click event and I already have that. but still it gives me error and does not even generate swf file.

Here is the code and error.

1061: Call to a possibly undefined method save through a reference with static type flash.net:FileReference. It gives me this error.

var cFile:FileReference = new FileReference();
var gBytes:ByteArray = this._myPDF.save(Method.LOCAL);
cFile.save(gBytes,"test.pdf"); 

Solution

  • If you just want to prompt user to save the file in local system, you can try FileReference for that.

    like :

    file = new FileReference();
    file.addEventListener(Event.COMPLETE, completeHandler);
    file.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
    file.save(mc, "myMovieClip");
    

    here mc is any type of data you can provide, in your case you can provide your dynamically generated PDF file, and "myMovieClip" is name which you wan to give that file.

    try this, might be useful for you.