Loading Safari with binary data from IOS Mobile app

Hi, I have a web service that returns a PDF in one of its JSON response fields (cut down example)
    {"Binary":"JVBERi0xLjU....... another 32,000 bytes of binary PDF.....0Y="}

Inside my mobile app (reactive) I'm trying to load the web browser with that PDF using a bit of JavaScript like this....

      var blob = new Blob([$parameters.binary], {type: 'application/pdf'});

      var myUrl = URL.createObjectURL(blob);

      .... Where $parameters.binary is mapped as type Binary, then using window.open and setting the url to myUrl

This doesn't seem to be working (Safari says the PDF cannot be opened on my unique url) and I think it's maybe because my binary data isn't being loaded correctly into the blob, but I'm not familiar enough with JavaScript to fully understand how this works.

Has anyone ever done this and please can you advise where I'm going wrong with my JavaScript?

Thanks in advance for any help.


Hi Richard,

There is a forge component called PdfJs, that you might want to try. The only thing is, it requires a url to the Pdf. What you can do is to consume the pdf binary on the backend and serve that to the app. I made a quick example attached here. Hope this helps.

Regards.