Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

%PDF-1.4 is response

axios.post('http://www.example.com/generatePDF.php',
  {...params},
  {responseType: 'blob',  // VERY IMPORTANT
  headers: {'Accept': 'application/pdf'}})
.then((response) => {
  const blob = new Blob([response.data])
  const url = window.URL.createObjectURL(blob)
  this.setState({fileUrl: url, loading: false})
})
 
PREVIOUS NEXT
Tagged: #response
ADD COMMENT
Topic
Name
8+8 =