title: Create and download PDF based on JSON sent by AJAX POST request
body: <p>I'm trying to create a PDF file using iText based on JSON from a client. HTML form data doesn't suit me because it encodes JSON and it does not work properly in some browsers, so i tried to use AJAX instead. But after all i got an empty PDF file. </p>
  
  <p>I tried to use the following: </p>
  
  <pre><code>            that.parsedEstimator = JSON.stringify(json); //target object
              $.ajax({
                  type: "POST",
                  url: "&lt;SERVLET_PATH&gt;",
                  contentType: "application/json",
                  cache: false,
                  data: that.parsedEstimator,
                  success: function (data) {
                      a = document.createElement('a');
                      var binaryData = [];
                      binaryData.push(data);
                      a.href = window.URL.createObjectURL(new Blob(binaryData, {type: "application/pdf"}));
                      a.download = "Estimation.pdf";
                      a.style.display = 'none';
                      document.body.appendChild(a);
                      a.click();
                  }
              });
  </code></pre>
  
  <p>There's a response processing from the servlet </p>
  
  <pre><code>response.setContentType("application/pdf");
  response.setHeader("Content-Disposition", "attachment; filename=Estimation.pdf");
  </code></pre>
  
  <p>What should i do to solve this issue?</p>
  
  <p>Thanks a lot.</p>