Swagger UI Download PDF

I use swagger-UI 2.1.3 for API documentation and in the backend, I use spring -webmvc.

I have one API that returns a PDF file, it works fine if I find the URL in the browser (it pops up, loading and the downloaded file works fine)

But the same api does not work in swagger ui, it gives me a download link after clicking "try out", and this link downloads the file, but this file shows me blank pages in pdf format (damaged pdf file).

Answer headers follow

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 

Any solution around this?

Addition Information:

These questions seem similar - AngularJS: Show blob (.pdf) in angular app

There they say set responseType for arraybuffer in xhr, but I think swaggar will take care of this (maybe I need to set some configuration?)

+7
spring-mvc swagger-ui
source share

No one has answered this question yet.

See similar questions:

84
AngularJS: display blob (.pdf) in angular app
0
Swagger UI blank PDF download

or similar:

one
Getting 400 errors using POST when communicating with another domain
0
406, while the data returned from the java spring controller is on the angularjs function
0
Tomcat 7 INCOMPLETE_CHUNKED_ENCODING
0
404 when presenting the shape of the spring
0
Spring Oauth2 CORS Problem
0
Lose headers with ContentCachingResponseWrapper
0
In spring mvc, when I press CURL and then I get an error in spring MVC
0
Could there be parameter fields for content headers in swagger-ui for specific form data content in the body of a multi-part request in swagger-3.0?
0
Spring MVC download PDF chrome version

All Articles