I am returning a byte[] of PDF content as JSON response from REST API, and trying to render the data in angular JS.
here is my JS code snippet :
if(data.appStatusCode===0){                            
    var jsonObj = JSON.parse(data.payload);
    var reportData = jsonObj.data;                              
    var file = new Blob([reportData], {type: 'application/pdf'});
    var fileURL = URL.createObjectURL(file);
    window.open(fileURL);
 }
and the controller which returns byte[] as payload
@RequestMapping(value = "/janitramwebreport/{janitramid}",
            method = RequestMethod.GET, 
            produces = Constants.APPLICATION_JSON_VALUE)
public ResponseEntity<ResponseVO> getReportWebPdf(HttpEntity<?> httpEntity) {
    *//returns byte[] as the payload*
}
when I try to generate PDF in a new window, I get PDF file error message.
 
     
     
    