0

I am trying to view a pdf document from memorystream in a new window.but some error are showing like "Uncaught SyntaxError: Unexpected token %"

here is my code

public ActionResult ViewDocument()
        {
    byte[] FileArr = fileRepo.GetBlockByte();
                    MemoryStream pdfStream = new MemoryStream(FileArr);
                    byte[] byteInfo = pdfStream .ToArray();
                    pdfStream .Write(byteInfo, 0, byteInfo.Length);
                    pdfStream .Position = 0;
                    return new FileStreamResult(pdfStream , "application/pdf");
}

can any one help actually why this error occur?

Thanks in advance

Arun
  • 1,402
  • 10
  • 32
  • 59
  • that sounds like a javascript error - where's this called from? – Daniel A. White May 30 '16 at 11:06
  • it is calling from an ajax call. $.ajax({ url: $(document.body).data('url') + 'Reports/ViewDocument', type: 'POST', //contentType: 'application/json', dataType: 'json', traditional: true, cache: false, success: function () { }, complete: function () { } }); – Arun May 30 '16 at 11:07
  • have a look here: http://stackoverflow.com/questions/34586671/download-pdf-file-using-jquery-ajax – Daniel A. White May 30 '16 at 11:08

0 Answers0