I've the following problem. I perform an Ajax call from JS to a aspx page, passing as parameter a base64 encoded pdf. My calling function is the following:
function PDF_Generator(base64)
{
var ESBParams = 
{
    encodedString : base64
}
try
{
    $.ajax({
        method      : "POST",
        url         : pws_PDF_parsing_url,
        data        : ESBParams,
        dataType    : "html",
        async       : "false",
        error       :
        function (xhr, err, errth){
            alert('ERROR:' + errth);
        },
        success     :
        function (success){
            window.open(success);
        }
    });
}
catch(obj)
{
    alert(obj.messsage);
}
}
Now, I have the following aspx page which decode the base64 string, and I would come back the stream of decoded pdf to javascript function, in order to visualise it in a new page (or in an another way - I'll appreciate any advices).
using System;
public class PDF_Generator : System.Web.UI.Page
{
private string decodedPDF;
private string base64EncodedPDF;
Decoder decoder = new Decoder();
protected void Page_Load(object sender, EventsArgs e)
{
    try
    {
        this.base64EncodedPDF = Request.Params["encodedString"]; //get encoded string from js
        this.decodedPDF = decoder.decodeFromBase64toString(this.base64EncodedPDF); //decode string
        byte[] pdfByteStream = decoder.getBytesFromString(this.decodedPDF);
        Page.Response.ClearContent();
        Page.Response.ContentType = "application/pdf";
        Page.Response.AddHeader("Content-Disposition", "inline; filename=" + "summary.pdf");
        Page.Response.AddHeader("Content-Length", pdfByteStream.Length.toString());
        Page.Response.BinaryWrite((byte[])pdfByteStream);
        Page.Response.End();
    }
}
}
