I am encountering an issue with displaying my PDF file. The data is coming as a byte array, and this is how I currently have it set up:
// data is initially String {0: % 1:P 2:D ...}
const byteArray = _.map(data); // ["%", "P", "D", "F", "-", "1", ".", "4", "↵", ...]
const blob = new Blob(byteArray, {type: 'application/pdf'});
const blobURL = URL.createObjectURL(blob);
window.open(blobURL),
When I log the Blob, everything seems correct in terms of length. However, when I try to open the PDF, it appears empty. The tab's header is the only thing displayed correctly, which leaves me wondering what could be going wrong. It is possible that the issue lies within the backend where the data is retrieved from, but unfortunately, I do not have access to it. I would appreciate any suggestions for better formats to transfer the data from the backend if needed.
Could the original presentation of the data be incorrect?
Edit:
Interestingly, when I make the same request using postman, the file displays correctly without any extra steps