I am fetching the pdf from backend and showing it in the component.
The functionality looks like this:
axios(`${apiURL}/pdf`, {
method: 'GET',
responseType: 'blob' //Force to receive data in a Blob Format
})
.then(response => {
//Create a Blob from the PDF Stream
const file = new Blob(
[response.data],
{type: 'application/pdf'});
//Build a URL from the file
const fileURL = URL.createObjectURL(file);
//Open the URL on new Window
window.open(fileURL);
})
.catch(error => {
console.log(error);
});
However the problem is that when you open that component in the top part of the pdf it shows random numbers on the left of the PDF pages number, which is probably string generated with createObjectURl. How can I change it and display custom title or parameter from react router?