I've been trying to find an example online where a PDF is returned by an external API (file sent in response, with the response headers for the Content-Type set to application/pdf) and then the file is processed in JS and shown in an embedded div/iframe.
I've been trying to find an example of that using PDF.js or PDFObject but all I can find use direct path to pdf files hosted on the server. I need to do this on the client-side and the file can only be retrieved using an API.
I apologize if that has been responded somewhere but I can't find anything matching my request, I hope I'm describing it well enough!
//Pseudo code of what I'd like to achieve
$.get('http.service.com/getPDF', function(data) {
var pdfString = changeDataToPDFString(data);
magicLibrary.previewPDF(pdfString, $('#container_pdf'));
}