Ask a how-to question
I want to preview using a PDF binary stream, but there is an error message that says’ download failed ', and there is also a request 403
Request URL: http://x.x.x.x:18760/downloadfile/document-1856194310425788418-1731395483584
Request Method:POST
Status Code:403 Forbidden
Request Payload:{url: “blob:http://localhost:3100/90684a5a-dcdb-46aa-994c-ce153b02b215”}
my code:
async function previewFile(row) {
const res = await queryFileStreamWaterMarkApi({ id: row.id })
// res is binary stream
// const blob = new Blob([res], { type: 'image/png' })
// const src = window.URL.createObjectURL(blob)
let url = window.URL.createObjectURL(res)
fileInfo.value = {
...row,
filePath: url,
}
}
If we change the filePath to http://xjrbmgl.ts.cn/newspaper/2024-11-10/19/52-2792358.pdf It can be displayed