Skip to main content
Inspiring
February 15, 2011
Question

AlivePDF printing without server side

  • February 15, 2011
  • 2 replies
  • 2486 views

Hi,

I am using AlivePDF to generate/save pdf on local machine which is working fine.[PHP]

var savePDF:PDF;
var bytes:ByteArray;
var f:FileReference = new FileReference();

savePDF = new PDF (Orientation.PORTRAIT, Unit.POINT, Size.LETTER);

for (var i:int = 0; i <numPages; i++) {
     //add all pages
}

bytes = savePDF.save( Method.LOCAL);
f.save(bytes, "abc.pdf");[/PHP]

I am looking for a solution through which I can print the pdf without using any server side technology.

Any help is appreciated.

This topic has been closed for replies.

2 replies

February 15, 2011

I think you are already creating pdf from client-side. There is no server side reference in your code. Below code works fine and has three options.

private function pdfToSystem(pdfName:String):void

{

       

//Saving from the air application.

var fs:FileStream = new FileStream();

var fl:File = File.documentsDirectory.resolvePath(pdfName+".pdf");

fs.open(fl,FileMode.WRITE);

var ba:ByteArray = pdf.save(Method.LOCAL);

fs.writeBytes(ba);

fs.close();

fl.openWithDefaultApplication();

//saving from plash player.

/*

var ba:ByteArray = pdf.save(Method.LOCAL);

var fileRef:FileReference = new FileReference();

fileRef.save(ba, pdfName+".pdf");

*/

//using server side help

//pdf.save(Method.REMOTE, "http://alivepdf.bytearray.org/wp-content/demos/create.php", pdfName+".pdf");

}

Regards,

skb8036.

Kenneth Kawamoto
Community Expert
Community Expert
February 15, 2011

You could run a command via fscommand(exec) but this won't work from a browser.

Inspiring
February 15, 2011

The application I am working on is online application.