Good morning,
I have a code posting some data to a webserver. The server then delivers a PDF to the client (my app). But I don’t know how to open this.
The response body holds the PDF data. But how can I show it? Do I have to save the data first and then open it? If that is the case how can I do it? Or is there another way?
Here is my current code:
// Post some data and retrieve PDF
HttpRequest.post(url, defect)
.auth(AppSettings.remoteUser, AppSettings.remotePassword)
.set('Content-Type', 'application/x-www-form-urlencoded')
.then(function(res) {
let responseBody = res.body
console.log("PDF creation OK")
// Open the provided PDF...
})
.catch(function(err) {
console.error(err.message)
console.error(err.response)
})
Thank you
Martin