javascript - Empty and broken pdf file downloaded from UI using spring mvc and apache pdf box -
the following code works fine no error able download file name specified in code issue there no content printed , when open file error saying file damaged. while save file somewhere proper file contents. from ui: var jsonstrtosend = json.stringify( jsonobjtosend ); jsonstrtosend = jsonstrtosend.replace(/"/g, """); var url = '/'+apppath+'/reportgeneration' ; var $form = $('<form enctype=\'application/json\' action="' + url + '" method="post">').append($('<input type="hidden" name="data" id="data" value="' + jsonstrtosend + '" />')); $form.appendto("body").submit(); in controller: @requestmapping(value = "/reportgeneration", method = requestmethod.post) public @responsebody void reportgeneration(httpservletrequest request, httpservletresponse response){ map returnmapm