Swagger UI Download PDF
<p>I am using swagger-UI 2.1.3 for API documentation and in backend, I am using spring-webmvc .</p>

<p>I have one API which returns a pdf file, it works fine if I type the URL in browser (it popups a download and downloaded file works fine)</p>

<p>But the same api won't works in swagger ui, it gives me a download link after clicking on "try out", and that link downloads a file, but that file shows me blank pdf pages (corrupted pdf file) .</p>

<p>The response headers are following </p>

<pre><code>HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: public
Expires: 0
Access-Control-Allow-Origin: *
Content-Description: File Transfer
Content-Transfer-Encoding: binary
Transfer-Encoding: chunked
Content-Disposition: attachment; filename="example.pdf"
Access-Control-Expose-Headers: Content-Description,Content-Disposition,location
Content-Type: application/pdf
Content-Length: 268288
Date: Mon, 04 Jan 2016 12:18:16 GMT
</code></pre>

<p>Any solution around this ?</p>

<p><strong>Addition Info:</strong></p>

<p>This questions seems similar -
<a href="https://stackoverflow.com/questions/21628378/angularjs-display-blob-pdf-in-an-angular-app">AngularJS: Display blob (.pdf) in an angular app</a></p>

<p>There they are saying that set responseType to arraybuffer in xhr, But i think that swaggar will take care of that (maybe i need to set some configuration??) </p>