The background returns the file stream, and the front end downloads into a pdf file, which is downloaded successfully, but the display is blank and there are no files, please give me some advice?

1, the backend returns the file stream

clipboard.png
2pdf

clipboard.png


3.

clipboard.png

Apr.20,2021

I don't know if the landlord's problem has been solved. Let's answer it first. Maybe someone will need it later. Today, I also encountered the same problem when doing the same function. The downloaded pdf file has been blank all the time. Later, after consulting a lot of materials, I found that it is necessary to set up responseType: arraybuffer before downloading the content. For example, whether
axios.get ( url , {
responseType: arraybuffer
}). Then ()


responseType is set correctly, binary files are generally set to blob.


if the backend is a byte stream
frontend setting: response-type=blob, can normally receive


Mobile does not support this kind of download


@ melancholy Little Adong Hello, have you solved this problem? I have the same problem as you


how was the problem solved finally

Menu