I am new to angular js and I want to open the PDF in a new browser window after clicking a button.
I am making a GET request with $http.get() on the front panel, in the backend there is a Java service that responds with GET and generates a PDF. I want to open this PDF file in a browser.
If it is not possible to open a PDF in this way, then at least open any PDF using AngularJs, how can I do this?
@GET @Path("/printPdf") public Response printService(){ //generates the pdf File reportFile = new File(filePath); String name = reportName + "." + "pdf"; ResponseBuilder response = Response.ok(new TemporaryFileInputStream(reportFile)); response.header("Content-Disposition", "attachment; filename=" + name); response.header("Content-Type", "application/pdf"); response.header("Access-Control-Expose-Headers", "x-filename"); response.header("x-filename", name); return response.build(); }
this is what is on the backend to generate a response in the recreation service.
DarkAngeL
source share