📜  %PDF-1.4 是响应 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:26.907000             🧑  作者: Mango

代码示例1
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})
})