This is another question that gets asked a lot - How is the PDF being generated. One thing to clarify : Flexicious does not generate any PDF's, nor does it have any intrinsic dependency on AlivePDF. Here is where the PDF functionality originated: When we did the Print Functionality, in addition to the grizzly task of actually printing the grid data, we also wanted to give the users a pretty preview of what is about to be printed. So we desinged the preview screen. One of our clients suggested the need to export the preview as a pdf. And thats where Flexicious met AlivePDF. So in the client section of our sample project, we included AlivePDF, to demonstrate, how instead of sending the print to the printer, you send it to alive pdf, get the pdf generated, and then send it to the server to simply buffer it back. (See the post in regards to Export EchoUrl for an explanation of this).There is nothing stopping you from experimenting with purePDF or any other pdf library, or simply sending the raw data to the server to make a pdf on the server. We just found AlivePDF to be pretty robust and very easy to use.

Now back to buffering the pdf : what if you want to implement your own pdf buffering (to avoid a trip across the internet to our servers)? Simple, - 4-5 lines of code in your server, a slight modification (Line 111 on MyPreviewRenderer.mxml), and voila. The server code for this is below (This is .NET, Java/PHP/Anything else would be similar):

            string method = Request.QueryString["method"];
            string name = Request.QueryString["name"];

            byte[] data = Request.BinaryRead(Request.TotalBytes);

            Response.ContentType = "application/pdf";
            Response.AddHeader("Content-Length", data.Length.ToString());
            Response.AddHeader("Content-disposition", method + "; filename=" + name);
            Response.BinaryWrite(data);
            Response.End();


There is a nice link that explains how to do this in php:
http://blog.unthinkmedia.com/2008/09/05/exporting-pdfs-in-flex-using-alivepdf/

If you are using Flash Player 10 or Flex 4, you can use the code below for local file persistence and avoid this altogether:

(This code is included in MyPreviewRenderer.mxml, line 111. You simply have to uncomment it, include the appropriate imports, and comment out the current line that says remote file persistence.)

var fileReference:FileReference = new FileReference();
var bytes:ByteArray = pdf.save(Method.LOCAL);
fileReference.save(bytes, "file.pdf");

MyPreviewRenderer.mxml (9.62 kb)

MyPreviewRenderer.mxml (9.62 kb)

 

================================================================

Update - For Ultimate, this process is a lot simpler, where you simply have to modify the built in AlivePDFGenerator to enable server/client generation/buffering.